Cerca

Heus ací els resultats de la cerca.

2.6 Abstract classes @info:cursos:pue:python-pcpp1:m1
19 Resultats, Darrera modificació:
tiated: <code python> class BluePrint: def hello(self): print('Nothing is blue unless you need it') bp = BluePrint() bp.hello() </code> There’s nothing new for you here – it’s... rint(abc.ABC): @abc.abstractmethod def hello(self): pass class GreenField(BluePrint): def hello(self): print('Welcome to Green Field!')
2.4 Decorators @info:cursos:pue:python-pcpp1:m1
16 Resultats, Darrera modificació:
heory. So, let's create a function – ''simple_hello()'' is one of the simplest functions we could thi... rate it in a moment. <code python> def simple_hello(): print("Hello from simple function!") </code> <code python> def simple_decorator(function): ... de python> decorated = simple_decorator(simple_hello) decorated() </code> The whole code should look l
4.1 Logging in Python @info:cursos:pue:python-pcpp1:m5
7 Resultats, Darrera modificació:
> import logging logger = logging.getLogger() hello_logger = logging.getLogger('hello') hello_world_logger = logging.getLogger('hello.world') recommended_logger = logging.getLogger(__name__) </co
4.1 PEP 257 – Docstring Conventions @info:cursos:pue:python-pcpp1:m2
6 Resultats, Darrera modificació:
<code 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
5.1 The configparser module @info:cursos:pue:python-pcpp1:m5
6 Resultats, Darrera modificació:
calhost # This is a comment. [mariadb] name = hello user = user password = password [redis] port = 6... '] mariadb section: Host: localhost Database: hello Username: user Password: password redis section:... host' }, 'mariadb': { 'name': 'hello', 'user': 'root', 'password': 'pa... '] mariadb section: Host: localhost Database: hello Username: root Password: password redis section:
1.6 Events and how to handle them @info:cursos:pue:python-pcpp1:m3
3 Resultats, Darrera modificació:
ter as tk from tkinter import messagebox def hello(dummy): messagebox.showinfo("", "Hello!") window = tk.Tk() button = tk.Button(window, text="On/... 20) frame.pack() window.bind_all("<Button-1>", hello) window.mainloop() </code> Play with the code.
4.1 Shallow and deep copy operations @info:cursos:pue:python-pcpp1:m1
2 Resultats, Darrera modificació:
elf.properties = ["112", "997"] print("Hello from __init__()") a_example = Example() b_exampl... t to get the following output: <code ; output> Hello from __init__() Memory chunks: 140319166493840 14
3.1 PEP 8 – Introduction @info:cursos:pue:python-pcpp1:m2
2 Resultats, Darrera modificació:
1980 } , "string" ) if 5 in my_list : print( "Hello!" ) ; print( "Goodbye!" ) </code> <code python ✔>... ear": 1980}, "string") if 5 in my_list: print("Hello!"); print("Goodbye!") </code> In the case of a
1.1 SQLite @info:cursos:pue:python-pcpp1:m5
2 Resultats, Darrera modificació:
python>import sqlite3 conn = sqlite3.connect('hello.db')</code> The ''connect'' method returns the d... ort sqlite3 conn = sqlite3.connect('C:\sqlite\hello.db')</code> It's also possible to use a special
4.2 Serialization of Python objects using the pickle module @info:cursos:pue:python-pcpp1:m1
1 Resultats, Darrera modificació:
de python> import pickle def f1(): print('Hello from the jar!') with open('function.pckl', 'wb')
2.1 PEP 20 – The Zen of Python @info:cursos:pue:python-pcpp1:m2
1 Resultats, Darrera modificació:
o reduce density. Example: Print the message “Hello, World!” if the value passed to the x variable eq