por

Cerca

Heus ací els resultats de la cerca.

3.1 PEP 8 – Introduction @info:cursos:pue:python-pcpp1:m2
35 Resultats, Darrera modificació:
thon code. PEP 8 is considered one of the most important PEPs and a must-read for every professional P... t means we must not forget about one simple but important observation:** our code will be read much mor... nsistency. Consistency with this style guide is important. Consistency within a project is more important. Consistency within one module or function is the
1.2 Let TkInter speak! @info:cursos:pue:python-pcpp1:m3
27 Resultats, Darrera modificació:
= 1.2 Let TkInter speak! == Importing TkInter As you already know, from Python's point of view TkInter ... elf consists of four essential elements: * **importing** the needed **tkinter** components; * **cr... at the same time the less controllable) way of importing tkinter facilities is to import the package as a whole: <code python>import tkinter</code> Note:
2.4 Shaping the main window and conversing with the user @info:cursos:pue:python-pcpp1:m3
24 Resultats, Darrera modificació:
fate is shared among **two** masters: **you** (supported by tkinter) and your **operating system**. Thi... after which the title remains 0. <code python> import tkinter as tk def click(*args): global cou... s icon is more troublesome if you want to do in a portable way. Here’s one working solution, although w... de we've provided in the editor. <code python> import tkinter as tk window = tk.Tk() window.title('Ic
1.7 Four magic letters: CRUD @info:cursos:pue:python-pcpp1:m4
24 Resultats, Darrera modificació:
n-server --watch cars.json</code> **Note (very important)** – the fact that the ''json-server'' serves... but will grow soon – we promise: <code python> import requests try: reply = requests.get("http://... print("Server error") </code> * line 1: we import the ''requests'' module; * line 3: we’re going... the address specified as localhost, listening at port number 3000; * line 5: have we succeeded? *
2.3 A small lexicon of widgets - Part 3 @info:cursos:pue:python-pcpp1:m3
22 Resultats, Darrera modificació:
the code and test its behavior. <code python> import tkinter as tk def digits_only(*args): glob... , option, ...) </code> Let’s summarize the most important menu traits: * a classic menu is actually ... add_command() method invocation) <code python> import tkinter as tk from tkinter import messagebox def about_app(): messagebox.showinfo("App", "The a
1.6 Making life easier with the requests module @info:cursos:pue:python-pcpp1:m4
19 Resultats, Darrera modificació:
-vxx.yy.z-x86.msi'') from the LTS //(Long Time Support//) branch; accept all the default settings and l... calhost'') and you want the client to go to the **port number 3000** (json-server's default port). You should see something like this: {{ :info:cursos:pue:... 'requests'' module. Take a look: <code python> import requests reply = requests.get('http://localhost
1.2 How to use sockets in Python @info:cursos:pue:python-pcpp1:m4
18 Resultats, Darrera modificació:
hon-pcpp1:m4:pasted:20240108-104229.png }} === Importing a socket We are in need - we need a socket. H... we'll put at the top of our code: <code python> import socket </code> === Obtaining user input We also... it better. Let's ask him or her: <code python> import socket server_addr = input("What server do you ... for us only to the extent that it is able to transport HTTP traffic, and HTTP is interesting for us onl
1.1 SQLite @info:cursos:pue:python-pcpp1:m5
18 Resultats, Darrera modificació:
brary enclosed in one source file. SQLite also supports transactions, which are a set of database opera... on. In this part of the course, you'll have the opportunity to learn about a new module that will allow... en by you. To use the sqlite3 module, you must import it in your script: <code python>import sqlite3</code> NOTE: The sqlite3 module has been available in
5.1 The configparser module @info:cursos:pue:python-pcpp1:m5
18 Resultats, Darrera modificació:
standard library. To start using it, we need to import the appropriate module: <code python>import configparser</code> However, before we start reading th... = hello user = user password = password [redis] port = 6379 db = 0</code> Our configuration file con... s ''Redis'' configuration data, consisting of the port and database number. In addition, both in this s
4.1 PEP 257 – Docstring Conventions @info:cursos:pue:python-pcpp1:m2
17 Resultats, Darrera modificació:
uestion: why is commenting and documenting code important? Essentially, we must not forget this simple... nt and useful way to highlight some of the more important code information, especially when publishing ... you can plug in to your editor or IDE, it can support your code-writing by autocompleting your typing ... dules, functions, classes, and methods that are exported by a given module **should have docstrings**.
2.1 File processing - XML files @info:cursos:pue:python-pcpp1:m5
17 Resultats, Darrera modificació:
s a markup language intended for storing and transporting data, e.g., by systems using the SOAP communi... hich we can move up or down. First, we need to import the appropriate module and define an alias for i... it to the parse method as follows: <code python>import xml.etree.ElementTree as ET tree = ET.parse('bo... n argument, takes XML as a string: <code python>import xml.etree.ElementTree as ET root = ET.fromstrin
1.4 Talking to JSON in Python @info:cursos:pue:python-pcpp1:m4
15 Resultats, Darrera modificació:
that you knew it before we asked: <code python> import json </code> The first JSON module's power is t... – we don't expect anything more: <code python> import json electron = 1.602176620898E10−19 print(json... ame but with a string, like this: <code python> import json comics = '"The Meaning of Life" by Monty P... do you think about this example? <code python> import json my_list = [1, 2.34, True, "False", None, [
4.2 Serialization of Python objects using the pickle module @info:cursos:pue:python-pcpp1:m1
13 Resultats, Darrera modificació:
Remember to run the code locally. <code python> import pickle a_dict = dict() a_dict['EUR'] = {'code':... ile_out) </code> The code starts with the import statement responsible for loading the pickle module: <code python> import pickle </code> Later you can see that the file ... he file opened for writing in binary mode. It’s important to open the file in binary mode as we are dum
2.1 PEP 20 – The Zen of Python @info:cursos:pue:python-pcpp1:m2
13 Resultats, Darrera modificació:
e the magic. Go to the editor window, type in ''import this'', run the code, and voilà! Can you see wha... function names, or adding more explicitness to imports or function arguments may be good practice. Example: Import ''apples'' and ''bananas'' from the //fruit.py//... ificity** of your project. Using a plane to transport yourself to a nearby shop could be okay (assumin
1.6 Events and how to handle them @info:cursos:pue:python-pcpp1:m3
13 Resultats, Darrera modificació:
rating how ''showinfo()'' works: <code python> import tkinter from tkinter import messagebox def clicked(): messagebox.showinfo("info", "some\ninfo")... itor won’t be a surprise to you. <code python> import tkinter as tk from tkinter import messagebox def click(): tk.messagebox.showinfo("Click!","I lo
3.1 The CSV module in Python @info:cursos:pue:python-pcpp1:m5
13 Resultats, Darrera modificació:
2.6 Abstract classes @info:cursos:pue:python-pcpp1:m1
12 Resultats, Darrera modificació:
1.5 A simple GUI application @info:cursos:pue:python-pcpp1:m3
11 Resultats, Darrera modificació:
2.5 Working with the Canvas @info:cursos:pue:python-pcpp1:m3
11 Resultats, Darrera modificació:
4.1 Logging in Python @info:cursos:pue:python-pcpp1:m5
11 Resultats, Darrera modificació:
2.4 Decorators @info:cursos:pue:python-pcpp1:m1
10 Resultats, Darrera modificació:
4.1 Shallow and deep copy operations @info:cursos:pue:python-pcpp1:m1
8 Resultats, Darrera modificació:
1.7 Visiting widgets’ properties @info:cursos:pue:python-pcpp1:m3
7 Resultats, Darrera modificació:
5.1 Metaprogramming @info:cursos:pue:python-pcpp1:m1
6 Resultats, Darrera modificació:
1.3 JSON – our new friend @info:cursos:pue:python-pcpp1:m4
5 Resultats, Darrera modificació:
1.4 Coloring your widgets @info:cursos:pue:python-pcpp1:m3
4 Resultats, Darrera modificació:
1.8 Interacting with widget methods @info:cursos:pue:python-pcpp1:m3
3 Resultats, Darrera modificació:
2.1 Python core syntax @info:cursos:pue:python-pcpp1:m1
2 Resultats, Darrera modificació:
2.7 Encapsulation @info:cursos:pue:python-pcpp1:m1
2 Resultats, Darrera modificació:
1.1 What is PEP? @info:cursos:pue:python-pcpp1:m2
2 Resultats, Darrera modificació:
1.9 Looking at variables @info:cursos:pue:python-pcpp1:m3
2 Resultats, Darrera modificació:
2.3 Extended function argument syntax @info:cursos:pue:python-pcpp1:m1
1 Resultats, Darrera modificació: