Cerca
Heus ací els resultats de la cerca.
Resultats de text complet:
- 2.4 Decorators @info:cursos:pue:python-pcpp1:m1
- e classes. We'll talk about this a bit later. So from now on, the term 'decorator' will be understood a... code python> def simple_hello(): print("Hello from simple function!") </code> <code python> def sim... output> We are about to call "simple_hello" Hello from simple function! </code> Now let's create anothe... object representing our ''simple_function()'' and from that moment on it indicates the object returned b
- 2.2 Inheritance and polymorphism — Inheritance as a pillar of OOP @info:cursos:pue:python-pcpp1:m1
- inheritance is a way of building a new class, not from scratch, but by using an already defined repertoi... heritance in Python. You can derive any new class from more than one previously defined class. But mult... tion Order The spectrum of issues possibly coming from multiple inheritance is illustrated by a classica... erclass named A; there are two subclasses derived from A — B and C; and there is also the bottom-most su
- 1.1 SQLite @info:cursos:pue:python-pcpp1:m5
- inserting data (part 3) We’re only one step away from inserting our first task in the database. All we'... d_task'' that will get the task name and priority from the user instead of using hardcoded values. Will ... The ''SELECT'' statement allows you to read data from one or more tables. Its syntax looks like this: <code sql>SELECT column FROM table_name;</code> or <code sql>SELECT column1, c
- 1.2 How to use sockets in Python @info:cursos:pue:python-pcpp1:m4
- use sockets in Python == How to fetch a document from a server using Python We are going to write our f... e server** (the server wants to know what we want from it) - **receive the server's response** (it wil... ocket. How do we obtain a socket? Can we order it from an Internet store? Is it free? Yes, it's free. A... thing goes smoothly. Yes, we know. The awakening from this dream can be painful. The connection is rea
- 2.1 PEP 20 – The Zen of Python @info:cursos:pue:python-pcpp1:m2
- tice. Example: Import ''apples'' and ''bananas'' from the //fruit.py// module. {{ :info:cursos:pue:pyt... ormally walk the distance if you wanted to travel from the UK to the USA. Taking a plane would be a more... ay a message whether or not x is within the range from 4 to 6. {{ :info:cursos:pue:python-pcpp1:m2:past... problems and output a fine result. Although, far from expected. If the snippet constitutes just a tiny
- 3.1 Advanced techniques of creating and serving exceptions @info:cursos:pue:python-pcpp1:m1
- reason for this is that exceptions are inherited from BaseException, the most general exception class. ... spot an exception. In the case where you get data from an external source (console, file, etc.) you shou... raise RocketNotReadyError('Crew is incomplete') from e __main__.RocketNotReadyError: Crew is incomplet... raise RocketNotReadyError('Crew is incomplete') from e crew = ['John', 'Mary', 'Mike'] print('Final c
- 3.1 PEP 8 – Introduction @info:cursos:pue:python-pcpp1:m2
- are being identified as obsolete and discouraged from being followed. == The Hobgoblin of Little Minds... s the hobgoblin of little minds.” This is a quote from Ralph Waldo Emerson’s essay “Self-Reliance” where... nevitable, use Python’s implied line continuation from the previous page. In the case of docstrings and... t’s correct to make a one-line import using the ''from … import …'' syntax: <code python ✔> from subproc
- 1.1 Python Professional Course Series: RESTful APIs @info:cursos:pue:python-pcpp1:m4
- isn't actually a word - it's an acronym. It comes from three words of equal importance: * **RE**prese... ng you to transmit states' representations to and from the server**. Note: not the object, but its stat... a long road ahead of us. Let's start our journey from the very first step - from a story about how the network works and how it is possible to send and recei
- 1.5 What is XML and why do we prefer to use JSON? @info:cursos:pue:python-pcpp1:m4
- e **production year**, which is an integer number from a quite predictable range; * the **price**, which is (in general) a floating-point number from a completely unpredictable range. Note: there is ... an absolute value. We can say that most customers from all over the world when told that the car was bui... ribute named **currency**. Its value can be taken from an international standard named ISO4217, which ca
- 1.2 Let TkInter speak! @info:cursos:pue:python-pcpp1:m3
- speak! == Importing TkInter As you already know, from Python's point of view TkInter is a package named... ilities separately – just like this: <code python>from tkinter import Button</code> If you're an enthus... using the star as a component name: <code python>from tkinter import *</code> It's handy when you writ... it can bring some cumbersome troubles when names from the package's namespace cross with some of your p
- 1.6 Events and how to handle them @info:cursos:pue:python-pcpp1:m3
- our experiments is named ''showinfo()'', it comes from the ''messagebox'' module, and it needs **two arg... showinfo()'' works: <code python> import tkinter from tkinter import messagebox def clicked(): me... prise to you. <code python> import tkinter as tk from tkinter import messagebox def click(): tk.m... nswered immediately: * **Q**: What is an event from the event controller’s point of view? * **A**:
- 2.3 A small lexicon of widgets - Part 3 @info:cursos:pue:python-pcpp1:m3
- d invocation) <code python> import tkinter as tk from tkinter import messagebox def about_app(): ... as a hotkey) <code python> import tkinter as tk from tkinter import messagebox def about_app(): ... ve this goal. <code python> import tkinter as tk from tkinter import messagebox def about_app(): ... y simple way. <code python> import tkinter as tk from tkinter import messagebox def about_app():
- 2.9 Inheriting properties from built-in classes @info:cursos:pue:python-pcpp1:m1
- = 2.9 Inheriting properties from built-in classes Python gives you the ability to create a class that inherits properties from any Python built-in class in order to get a new c... f all of the well-known functionalities inherited from its parent or even parents and you can still acce... he genuine method ''%%__setitem__%%'' which comes from the parent class, which does the rest of the job
- 2.4 Shaping the main window and conversing with the user @info:cursos:pue:python-pcpp1:m3
- d called ''maxsize()'', which protects the window from becoming too large. Check the code in the editor... is mechanism. <code python> import tkinter as tk from tkinter import messagebox def really(): if ... usually, it’s focused on the button located first from the left; this can be changed by setting the keyw... verlook them. <code python> import tkinter as tk from tkinter import messagebox def question(): a
- 1.6 Making life easier with the requests module @info:cursos:pue:python-pcpp1:m4
- a name that looks like ''node-vxx.yy.z-x86.msi'') from the LTS //(Long Time Support//) branch; accept al... ng actions: * download the JSON file cars.json from here: Download {{ :info:cursos:pue:python-pcpp1:m... ssible that the server resides somewhere far away from our desk, for example, in the other hemisphere. T... property contains bare text taken as-is directly from the data stream, hence it is just a string. No co