Cerca

Heus ací els resultats de la cerca.

4.1 Shallow and deep copy operations @info:cursos:pue:python-pcpp1:m1
51 Resultats, Darrera modificació:
a variable, which you should treat as a label or name binding, is created, and this label refers to a d... <code python> import copy a_dict = { 'first name': 'James', 'last name': 'Bond', 'movies': ['Goldfinger (1964)', 'You Only Live Twice'] } b_... output** <code ; output> Source list of candies {'name': 'Lolly Pop', 'price': 0.4, 'weight': 133} {'nam
3.1 Advanced techniques of creating and serving exceptions @info:cursos:pue:python-pcpp1:m1
45 Resultats, Darrera modificació:
clause may specify a variable after the exception name. In this example it’s an ''e_variable''. This var... trying to load a module. The attributes are: * name – represents the name of the module that was attempted to be imported; * path – represents the path t... t ImportError as e: print(e.args) print(e.name) print(e.path) </code> <code ; output> ("No m
1.1 SQLite @info:cursos:pue:python-pcpp1:m5
36 Resultats, Darrera modificació:
example above, the method takes only the database name as the argument. This means that the database wil... .db')</code> It's also possible to use a special name, '':memory:'', which creates a database in RAM: <... onsist of only one table called tasks: * id * name * priority To create the above table, we’ll nee... tax looks like this: <code sql>CREATE TABLE table_name ( column1 datatype, column2 datatype, column3 dat
3.1 PEP 8 – Introduction @info:cursos:pue:python-pcpp1:m2
29 Resultats, Darrera modificació:
* **pycodestyle** (formerly called pep8, but the name was changed to avoid confusion) - Python style gu... st_one = [1, 2, 3, 4, 5, 6 ] a = my_function_name(a, b, c, d, e, f) </code> <code python ✔> #... 1, 2, 3, 4, 5, 6, ] a = my_function_name(a, b, c, d, e, f) </code> ... ituations where your comments or docstrings use a name (e.g., an author’s name) that contains a non-ASCI
5.1 Metaprogramming @info:cursos:pue:python-pcpp1:m1
25 Resultats, Darrera modificació:
familiar with some special attributes: * ''%%__name__%%'' – inherent for classes; contains the name of the class; * ''%%__class__%%'' – inherent for both... print('"dog" is an object of class named:', Dog.__name__) print() print('class "Dog" is an instance of:'... ype(, , )'': * the argument specifies the class name; this value becomes the ''%%__name__%%'' attribut
1.4 Talking to JSON in Python @info:cursos:pue:python-pcpp1:m4
23 Resultats, Darrera modificació:
'. Note: the ''’s'' at the end of the function's name means string. There is a very similar function with the name deprived of this suffix which **writes the JSON s... > import json class Who: def __init__(self, name, age): self.name = name self.age = age some_man = Who('John Doe', 42) print(json.dump
2.4 Decorators @info:cursos:pue:python-pcpp1:m1
21 Resultats, Darrera modificació:
a new "decorating" function (or class), hence the name "decoration". This is done by passing the origina... int('We are about to call "{}"'.format(function.__name__)) return function </code> The last lines a... accepts an object as a parameter, displays a ''__name__'' attribute value of the parameter, and returns... is is the most important thing to remember**: the name of the simple_function object ceases to indicate
4.1 Logging in Python @info:cursos:pue:python-pcpp1:m5
19 Resultats, Darrera modificació:
ll the ''getLogger'' function without providing a name. The root logger is at the highest point in the h... .world') recommended_logger = logging.getLogger(__name__) </code> Logger names are similar to the names... to get the Logger object, both with and without a name. We recommend calling the ''getLogger'' function with the ''__name__'' argument, which is replaced by the current mo
2.1 PEP 20 – The Zen of Python @info:cursos:pue:python-pcpp1:m2
17 Resultats, Darrera modificació:
For example, if you want to take the user’s first name and last name, and display them on the screen, you can do it in one of the following ways: <code python> first_name = input("Enter your first name: ") last_name = input("Enter your last name: ") print("Your name is:",
1.2 How to use sockets in Python @info:cursos:pue:python-pcpp1:m4
16 Resultats, Darrera modificació:
ode> === Obtaining user input We also need **the name of the HTTP server** we're going to connect to. I... two different forms: * it can be **the domain name of the server** (like //www.pythoninstitute.org /... e server to send a particular document of a given name is called GET (it's rather self-explanatory, isn'... ethod requires: * a line containing the method name (i.e., ''GET'') followed by the name of the resou
3.1 The CSV module in Python @info:cursos:pue:python-pcpp1:m5
16 Resultats, Darrera modificació:
'' that stores contacts from a phone: <code csv> Name,Phone mother,222-555-101 father,222-555-102 wife,... above file, there are four contacts consisting of name and phone number. Note that the first line contai... It should produce the following output: <code> ['Name', 'Phone'] ['mother', '222-555-101'] ['father', '... It should produce the following result: <code> Name,Phone mother,222-555-101 father,222-555-102 wife,
4.1 PEP 257 – Docstring Conventions @info:cursos:pue:python-pcpp1:m2
14 Resultats, Darrera modificació:
ode python># No type information added: def hello(name): return "Hello, " + name # Type information added to a function: def hello(name: str) -> str: return "Hello, " + name</code> Type hinting is **optional**, which means PEP 484 doe
1.5 What is XML and why do we prefer to use JSON? @info:cursos:pue:python-pcpp1:m4
13 Resultats, Darrera modificació:
story short, the DOCTYPE line contains: * the **name** of the XML document being defined (cars_for_sal... ded about it is its URI (which may be just a file name recognizable by the target server); * the **URI... tags look nearly identical, but the closing tag's name starts with /. Tags can be easily identified as t... tores the textual representation of the element's name – we use it to print the root element's name; *
2.7 Encapsulation @info:cursos:pue:python-pcpp1:m1
11 Resultats, Darrera modificació:
to read the encapsulated attribute value; * the name of the designated method will be used as the name of the instance attribute corresponding to the encaps... that the method following the decorator gives the name (tank) to the attribute visible outside of the cl... e the encapsulated attribute. As those attribute name repetitions could be misleading, let's explain th
1.2 Let TkInter speak! @info:cursos:pue:python-pcpp1:m3
8 Resultats, Darrera modificació:
isely: which creates an **alias** of its original name) at the time of import. **tk** looks shorter tha... st of your work) by using the star as a component name: <code python>from tkinter import *</code> It's ... main window's method, named **mainloop()**. The name is significant because – as you can see – there i... button has to be a parameterless function of any name. Don't forget that the function will be invoked,
5.1 The configparser module @info:cursos:pue:python-pcpp1:m5
8 Resultats, Darrera modificació:
1.3 JSON – our new friend @info:cursos:pue:python-pcpp1:m4
7 Resultats, Darrera modificació:
2.1 File processing - XML files @info:cursos:pue:python-pcpp1:m5
7 Resultats, Darrera modificació:
1.7 Visiting widgets’ properties @info:cursos:pue:python-pcpp1:m3
6 Resultats, Darrera modificació:
1.7 Four magic letters: CRUD @info:cursos:pue:python-pcpp1:m4
6 Resultats, Darrera modificació:
1.6 Events and how to handle them @info:cursos:pue:python-pcpp1:m3
3 Resultats, Darrera modificació:
2.5 Different faces of Python methods @info:cursos:pue:python-pcpp1:m1
2 Resultats, Darrera modificació:
2.6 Abstract classes @info:cursos:pue:python-pcpp1:m1
2 Resultats, Darrera modificació:
1.4 Coloring your widgets @info:cursos:pue:python-pcpp1:m3
2 Resultats, Darrera modificació:
2.1 Python core syntax @info:cursos:pue:python-pcpp1:m1
1 Resultats, Darrera modificació:
2.3 Extended function argument syntax @info:cursos:pue:python-pcpp1:m1
1 Resultats, Darrera modificació:
2.5 Working with the Canvas @info:cursos:pue:python-pcpp1:m3
1 Resultats, Darrera modificació: