de

Cerca

Heus ací els resultats de la cerca.

3.1 PEP 8 – Introduction @info:cursos:pue:python-pcpp1:m2
166 Resultats, Darrera modificació:
is a document that provides coding conventions (code style guide) for Python code. PEP 8 is considered one of the most important PEPs and a must-read for every profe... onal Python programmer, as it helps to make the code more consistent, more readable, and more efficien
4.1 PEP 257 – Docstring Conventions @info:cursos:pue:python-pcpp1:m2
119 Resultats, Darrera modificació:
ment created as part of the Python Developer's Guide, which makes an attempt to standardize the high-l... egulations!) associated with documenting Python code using docstrings. In short, it tries to answer th... function, and method definition in order to provide information about the functionality of a larger piece of code in a **prescriptive** way. They help programmers
1.7 Four magic letters: CRUD @info:cursos:pue:python-pcpp1:m4
96 Resultats, Darrera modificació:
P method. == U means Update You update data inside a collection when you modify the contents of the ... ur cars.json is located and launch the server: <code bash>json-server --watch cars.json</code> **Note (very important)** – the fact that the ''json-serve... transmit JSON messages between the client (our code) and the server (''json-server''). The way the se
1.1 SQLite @info:cursos:pue:python-pcpp1:m5
89 Resultats, Darrera modificació:
tems on the market. The most popular of them include: * Free: MySQL, PostgreSQL, SQLite * Paid: Or... hat have the same necessary equipment, but were made by other manufacturers. It's exactly the same wit... te3 module, you must import it in your script: <code python>import sqlite3</code> NOTE: The sqlite3 module has been available in Python since version 2.5.
2.1 PEP 20 – The Zen of Python @info:cursos:pue:python-pcpp1:m2
80 Resultats, Darrera modificació:
editor window, type in ''import this'', run the code, and voilà! Can you see what happens? What you s... encouraged to accept them and implement in your code. These, of course, should be looked upon holisti... png }} == Explicit is better than implicit The code you write should be **explicit and readable**. W... ality. If not, think about leaving a comment in code to explain what’s going on so that other programm
2.4 Decorators @info:cursos:pue:python-pcpp1:m1
75 Resultats, Darrera modificació:
essage logging; * thread synchronization; * code refactorization; * caching. == Function decora... ould think of. We'll decorate it in a moment. <code python> def simple_hello(): print("Hello from simple function!") </code> <code python> def simple_decorator(function): print('We are about to call "{}"'.format(function
3.1 Advanced techniques of creating and serving exceptions @info:cursos:pue:python-pcpp1:m1
73 Resultats, Darrera modificació:
aised) when it has no idea what do to with your code. What happens next? * the raised exception ex... an exception error message like the following: <code ; output> IndexError: list index out of range </code> Sooner or later, every Pythonista will write a code that raises an exception, and that is why it is s
2.1 File processing - XML files @info:cursos:pue:python-pcpp1:m5
73 Resultats, Darrera modificació:
it's parsed into a tree structure in which each node is an object. * **xml.sax** – SAX is an acronym... st of opening and closing tags. The elements include text, attributes, and other child elements. In th... XML tag must have a corresponding closing tag. <code xml><?xml version="1.0"?> <data> <book title="The Little Prince"> <author>Antoine de Saint-Exupéry</author> <year>1943</year>
1.4 Talking to JSON in Python @info:cursos:pue:python-pcpp1:m4
71 Resultats, Darrera modificació:
d we're sure that you knew it before we asked: <code python> import json </code> The first JSON module's power is the ability to automatically **convert ... puts a number – we don't expect anything more: <code python> import json electron = 1.602176620898E10−19 print(json.dumps(electron)) </code> The code outputs: <code ; output> 16021766189.98
1.6 Making life easier with the requests module @info:cursos:pue:python-pcpp1:m4
70 Resultats, Darrera modificació:
ed ''json-server'', implemented on top of the ''Node.js'' environment. ''Node.js'' is – as Wikipedia claims – //an open-source, cross-platform JavaScript run-time environment that executes JavaScript code outside of a browser//. Don't be afraid – we’re going to encounter JavaScript again, but we aren't go
4.1 Shallow and deep copy operations @info:cursos:pue:python-pcpp1:m1
67 Resultats, Darrera modificació:
It’s hard to imagine writing a piece of Python code that performs any kind of data processing without... ing them. When you spot the following clause: <code python> a_list = [ 1, 'New York', 100] </code> {{ :info:cursos:pue:python-pcpp1:pasted:20231026-1438... ement is being used, so evaluation of the right side of the clause takes precedence over the left side
1.5 What is XML and why do we prefer to use JSON? @info:cursos:pue:python-pcpp1:m4
58 Resultats, Darrera modificació:
ke a look – it's a simple sample XML document: <code xml><?xml version = "1.0" encoding = "utf-8"?> <!... <brand>Aston Martin</brand> <model>Rapide</model> <production_year>2010</production_y... "GBP">32000</price> </car> </cars_for_sale></code> The document contains a part of an offer publis... e first line – it plays a very important role: <code xml><?xml version = "1.0" encoding = "utf-8"?></c
5.1 Metaprogramming @info:cursos:pue:python-pcpp1:m1
56 Resultats, Darrera modificació:
nd implemented in the early 1960s. For Python, code modifications can occure while the code is being executed, and you might have already experienced it ... programmers to minimize the number of lines of code to express a solution, in turn reducing developme... eparation; those tools could be applied to your code to make it follow specific programming patterns,
2.3 A small lexicon of widgets - Part 3 @info:cursos:pue:python-pcpp1:m3
56 Resultats, Darrera modificació:
widget doesn’t take the focus itself. Run the code and test its behavior. <code python> import tkinter as tk def digits_only(*args): global last_... y.pack() entry.focus_set() window.mainloop() </code> Try to modify the code to allow the user to enter not more than five digits. The last part of our
4.2 Serialization of Python objects using the pickle module @info:cursos:pue:python-pcpp1:m1
53 Resultats, Darrera modificació:
ring, an integer, and a list. When you run the code presented in the right pane, a new file should be created. Remember to run the code locally. <code python> import pickle a_dict = dict() a_dict['EUR'] = {'code':'Euro', 'symbol': '€'} a_dict['GBP'] = {'code':'
1.2 How to use sockets in Python @info:cursos:pue:python-pcpp1:m4
50 Resultats, Darrera modificació:
2.5 Working with the Canvas @info:cursos:pue:python-pcpp1:m3
46 Resultats, Darrera modificació:
2.6 Abstract classes @info:cursos:pue:python-pcpp1:m1
45 Resultats, Darrera modificació:
1.2 Let TkInter speak! @info:cursos:pue:python-pcpp1:m3
44 Resultats, Darrera modificació:
1.6 Events and how to handle them @info:cursos:pue:python-pcpp1:m3
43 Resultats, Darrera modificació:
1.3 JSON – our new friend @info:cursos:pue:python-pcpp1:m4
40 Resultats, Darrera modificació:
4.1 Logging in Python @info:cursos:pue:python-pcpp1:m5
36 Resultats, Darrera modificació:
3.1 The CSV module in Python @info:cursos:pue:python-pcpp1:m5
32 Resultats, Darrera modificació:
2.5 Different faces of Python methods @info:cursos:pue:python-pcpp1:m1
31 Resultats, Darrera modificació:
1.7 Visiting widgets’ properties @info:cursos:pue:python-pcpp1:m3
29 Resultats, Darrera modificació:
2.3 Extended function argument syntax @info:cursos:pue:python-pcpp1:m1
28 Resultats, Darrera modificació:
2.7 Encapsulation @info:cursos:pue:python-pcpp1:m1
28 Resultats, Darrera modificació:
5.1 The configparser module @info:cursos:pue:python-pcpp1:m5
28 Resultats, Darrera modificació:
2.1 Python core syntax @info:cursos:pue:python-pcpp1:m1
24 Resultats, Darrera modificació:
1.5 A simple GUI application @info:cursos:pue:python-pcpp1:m3
24 Resultats, Darrera modificació:
1.8 Interacting with widget methods @info:cursos:pue:python-pcpp1:m3
21 Resultats, Darrera modificació:
1.9 Looking at variables @info:cursos:pue:python-pcpp1:m3
17 Resultats, Darrera modificació:
1.4 Coloring your widgets @info:cursos:pue:python-pcpp1:m3
13 Resultats, Darrera modificació:
1.1 What is PEP? @info:cursos:pue:python-pcpp1:m2
4 Resultats, Darrera modificació: