Snippets of the day – Sunday, October 27, 2013

Posted on Posted in Snippets


Here are some of the most recently published snippets!

Using Pickle To load serialized Objects from file In Python – String Deserialization

Once you have pickled some data and saved to a txt file, you may want to retrieve the data back to a valid and usable python object at run time.

To restore an object to memory, just load the file using pickle, assigning the value to the object itself.

Open the snippet

Author:    lbottaro

Using Pickle to Save Objects in Python – String Serialization

You can use the pickle module to save data in a serialized format, typically in a txt string, performing what is better known as data serialization, marshalling, or flattening.

Pickle allows you to save an object to a file for later retrieval.

Pickling some data will write the python object (dictionary, list, tuple, class) as one long stream of bytes, usually in a not human-readable format, to a specific text file.

Open the snippet

Author:    lbottaro

Leave a Reply

Your email address will not be published. Required fields are marked *