The pickle and cPickle modules are used to serialize Python objects into a stream of bytes suitable for storing in a file, transferring across a network, or placing in a database. This process is variously called pickling, serializing, marshalling, or flattening. The resulting byte stream can also be converted back into a series of Python objects using an unpickling process.
The pickling and unpickling processes are controlled by using Pickler and Unpickler objects, as created by the following two functions:
Pickler(file [, protocol ])
Creates a pickling object that writes data to the file object file.protocol specifies the output format of the data. Protocol 0 (the default) is a text-based format that is backward compatible ...