Cerca
Heus ací els resultats de la cerca.
Resultats de text complet:
- 4.2 Serialization of Python objects using the pickle module
- 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 Advanced techniques of creating and serving exceptions
- 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
- 4.3 Making Python objects persistent using the shelve module
- 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
- 2.6 Abstract classes
- player application, intended to support multiple file formats. Some of the formats are known now, but s... l just have to deliver a class supporting the new file format, fulfilling the contract imposed by the ab... le containing the ABC class instead of your local file. This could cause some confusion – why does such
- 2.1 Python core syntax
- ode ; output>Traceback (most recent call last): File "core#010.py", line 11, in print(p1 + p2) Ty
- 2.2 Inheritance and polymorphism — Inheritance as a pillar of OOP
- ode ; output>Traceback (most recent call last): File "diamond.py", line 13, in class D(A, C): Typ
- 2.3 Extended function argument syntax
- python> def print(self, *args, sep=' ', end='\n', file=None): </code> == Extended function argument s