CONCEPT: Serializing a object is the process of
converting the object to a stream of bytes
that can be saved to a file for later retrieval.
In Python, object serialization is called
pickling.
, Sometimes you need to store the contents of a complex object, such
dictionary or a set, to a file. The easiest way to save an object to a file
serialize the object. When an object is serialized, it is converted to a stre
bytes that can be easily stored in a file for later retrieval.
In Python, the process of serializing an object is referred to as pickling.
through module named ‘p i c k l e’ .
>>> import pickle
Once you import the pickle module, you perform the following steps to pickle a
object.
Pickling:
You open a file for binary writing.
You call the pickle module’s dump method to pickle the object and write it to
specified file.
After you have pickled all the objects that you want to save to the file, you c
the file.