pickle
Stdlib — SerializationPython 2.0+Intermediate
Serialize/deserialize Python objects to binary format
Quick Info
- Documentation
- Official Docs
- Python Version
- 2.0+
- Dependencies
- None — Python Standard Library
- Install
Included with Python
Learn by Difficulty
Quick Example
python
import pickle data = {"name": "Alice", "scores": [95, 87, 91]} pickled = pickle.dumps(data) print(f"Pickled: {pickled[:50]}...") unpickled = pickle.loads(pickled) print(f"Unpickled: {unpickled}")
The pickle module is part of Python's standard library. Serialize/deserialize Python objects to binary format.
Try in PlaygroundTags
stdlibserializationpersistencebinary
Related Items
json
Stdlib — Serialization
Encode and decode JSON data
shelve
Stdlib — Serialization
Persistent dictionary backed by pickle and dbm
marshal
Stdlib — Serialization
Internal object serialization (used for .pyc files)
dill
Package — Utility
Extended pickling: serialize functions, lambdas, closures, classes
cloudpickle
Package — Utility
Extended pickling for distributed computing (lambdas, closures)
joblib
Package — ML
Lightweight pipelining: memory caching and parallel execution