Data structure support


Pickle is used to store Python object structures like list or dict in a byte stream. In contrast to marshal, already serialised objects are tracked so that later references are not serialised again. Recursive objects are also possible.



Pickle is defined in the Python Enhancement Proposals Proposals PEP 307, PEP 3154 and :pep:``574`.

Schema IDL



Language support



Human readability


Pickle is a binary serialisation format, but it can be easily read with Python.



The pickle format can usually be serialised and deserialised quickly by Python; see also Don’t pickle your data.

File size


Compact binary format, which can, however, be compressed even further, see also Data Compression and Archiving.

See also

pickle – Python object serialization

Documentation of the pickle module

shelve – Python object persistence

Indexed databases of pickle objects

Uwe Korn: The implications of pickling ML models

Alternatives to pickle for ML models

Ned Batchelder: Pickle’s nine flaws

Disadvantages of pickle and alternatives