Cerca
Heus ací els resultats de la cerca.
Noms de pàgina coincidents:
Resultats de text complet:
- 2.3 A small lexicon of widgets - Part 3 @info:cursos:pue:python-pcpp1:m3
- ain menu item: an empty (as far) submenu sub_menu_file = tk.Menu(main_menu) main_menu.add_cascade(label="File", menu=sub_menu_file) # 2nd main menu item: a simple callback sub_menu_help = tk.Menu(main_menu) main_... at strange dashed line visible when you click the File main menu item? Don’t worry, this it’s normal. W
- 4.2 Serialization of Python objects using the pickle module @info:cursos:pue:python-pcpp1:m1
- ay to persist outcomes is to generate a flat text file and to write your outcomes. It’s a very simple th... e into a stream of bytes to store the object in a file or database, or to transmit it via a network. Thi... u run the code presented in the right pane, a new file should be created. Remember to run the code local... 100, 1000]] with open('multidata.pckl', 'wb') as file_out: pickle.dump(a_dict, file_out) pickle
- 3.1 The CSV module in Python @info:cursos:pue:python-pcpp1:m5
- parated Values) format is one of the most popular file formats used to store and transfer data between d... r data import and export in this format. The CSV file is a plain text file with the .csv extension. A typical file contains comma-separated values, but other separators such as s
- 5.1 The configparser module @info:cursos:pue:python-pcpp1:m5
- e. A better solution is to use the configuration file, which will be read by the code. In Python, this ... t familiarize ourselves with the structure of the file in which they're stored. Are you curious how this is done? == What does the configuration file look like? The structure of the configuration file is very similar to Microsoft Windows INI files. It c
- 4.1 Logging in Python @info:cursos:pue:python-pcpp1:m5
- ifferent places. Most often it's in the form of a file, but it can also be an output stream, or even an ... ur DEBUG message')</code> Result in ''prod.log'' file: <code>CRITICAL:root:Your CRITICAL message</code>... ument, all logs will be directed to the specified file. In addition, passing the last ''filemode'' argu... ode) means that new logs will be appended to this file. If you'd like to change this mode, you can use o
- 3.1 Advanced techniques of creating and serving exceptions @info:cursos:pue:python-pcpp1:m1
- re you get data from an external source (console, file, etc.) you should not trust the data types, so it... e imported; * path – represents the path to any file which triggered the exception, respectively. Coul... de ; output> Traceback (most recent call last): File "exceptions#030.py", line 6, in <module> prin... n occurred: Traceback (most recent call last): File "exceptions#030.py", line 8, in <module> prin
- 1.7 Four magic letters: CRUD @info:cursos:pue:python-pcpp1:m4
- a simple relational database residing in a single file, or on the contrary, a huge, distributed cloud of... ction of retro cars written down in the cars.json file (Download ''cars.json'' zip file); the ''json-server'' will read the file in and will handle its contents according to our actions; *
- 1.6 Making life easier with the requests module @info:cursos:pue:python-pcpp1:m4
- wnload, download and run the Windows installer (a file with a name that looks like ''node-vxx.yy.z-x86.m... ps://nodejs.org/en/download, download the ''pkg'' file and run the installer. Whole process looks the sa... Do the following actions: * download the JSON file cars.json from here: Download {{ :info:cursos:pue... h>json-server --watch cars.json</code> Note: the file name you put after ''–-watch'' should be specifie
- 2.1 File processing - XML files @info:cursos:pue:python-pcpp1:m5
- = 2.1 File processing - XML files == XML processing in Python Python is commonly used to process various... programmer, you'll have to read or create a data file in the XML format. Soon, doing that will be a pie... et's modify the element tree and create a new XML file based on it with the following movie data: <code ... method has only one required argument, which is a file name of the output XML file, or a file object ope
- 1.1 SQLite @info:cursos:pue:python-pcpp1:m5
- ows the user to read and write data directly to a file. You're surprised? The complete SQLite database is stored in only one file. Unlike other database management systems, SQLite... s a self-contained library enclosed in one source file. SQLite also supports transactions, which are a s... ing software for cars and airplanes. The database file is cross-platform, which means it can be copied b
- 4.1 PEP 257 – Docstring Conventions @info:cursos:pue:python-pcpp1:m2
- gs in the module docstring of the %%__init__%%.py file in the package folder. As we've said before, doc... ings (in the sense of stand-alone programs/single file executables) should document the script's functio... e installation guidelines; * an **examples.py** file, which is a script that demonstrates a few exampl... e project; * a **license** in the form of a txt file (particularly important for Open Source and Publi
- 1.5 What is XML and why do we prefer to use JSON? @info:cursos:pue:python-pcpp1:m4
- ced by MS Office applications (the newer one with file extensions ending with x like docx) utilizes XML ... to this line, a program responsible for parsing a file’s content is calm about the future. It knows what... n needed about it is its URI (which may be just a file name recognizable by the target server); * the ... line 1: no comment needed; * line 3: parse the file and fetch an object storing all elements – we’ll
- 4.3 Making Python objects persistent using the shelve module @info:cursos:pue:python-pcpp1:m1
- de by the order of all the elements placed into a file or database, or sent via a network. There is ano... rings. Therefore, you can open your shelved data file and access your pickled objects via the keys the ... priate module and create an object representing a file-based database: <code python> import shelve my_sh... shelve.close() </code> Now let's open the shelve file to demonstrate direct access to the elements (con
- 3.1 PEP 8 – Introduction @info:cursos:pue:python-pcpp1:m2
- all pycodestyle </code> * You can run it on a file or files to obtain information about non-conforma... khanov which lets you paste your code or upload a file, and validate it against the PEP 8 style guidelin... length, line breaks, and blank lines; * source file encoding and module imports. === Indentation The... paces, e.g., %%__init__%%,%% __import__%%, or %%__file__%%. You shouldn't create such names, but only us
- 2.4 Shaping the main window and conversing with the user @info:cursos:pue:python-pcpp1:m3
- .tk.call('wm', 'iconphoto', window._w, PhotoImage(file='logo.png')) window.bind("<Button-1>", lamb... PhotoImage'' class constructor to convert the PNG file into an internal ''tkinter'' representation (''Ph... .tk.call('wm', 'iconphoto', window._w, PhotoImage(file='logo.png')) window.bind("<Button-1>;", lambda e:... ter as tk window = tk.Tk() photo = tk.PhotoImage(file = 'logo.png') window.wm_iconphoto(False, photo) w