Pickle data serialization:
*Pickle data serialisation
pickle.dump(object,file,protocol) : serialize an object
pickle.load(file) : de-serialize an object
pickle.dumps(object, protocol) : serialize an object to bytes
pickle.loads(buffer) : de-serialize an object from bytes
object : the object which is to be stored |
file : the open file which will contain the object
protocol : the protocol used for pickling the object (optional parameter)
buffer : a bytes object that contains a serialized object|
The following objects are picklable.
None, True, and False
tuples, lists, sets, and dicts containing only picklable objects
__dict__ or the result of calling __getstate__() is picklable (see the official docs for details).
Based on the official Python documentation.
Pickle and security
The pickle module is not secure. It should not be used when receiving the serialized data from an untrusted party, such as over the Internet.