On this page
pickle.loads
Prev: pickle.load | Up: pickle | Next: pickle.PickleBuffer
Rel: pickle.dump, pickle.dumps, pickle.load, pickle.PickleBuffer
Ref: docs.python.org — pickle.loads
Tags: #public #python3 #stdlib #pickle
Import
import pickle
from pickle import loads
Signature & Overview
pickle.loads(data, /, *, fix_imports=True, encoding='ASCII', errors='strict', buffers=())
Read and return an object from the given pickle data.
Usage
import pickle
assert pickle.loads(pickle.dumps({"ok": True})) == {"ok": True}
Gotchas
- Trusted data only: Use
json.loads()for untrusted inputs or cross-language data.
REPL Inspect
from pickle import loads
help(loads)
Linked from
- tuts/python3/stdlib_module/pickle
- tuts/python3/stdlib_module/pickle/dump
- tuts/python3/stdlib_module/pickle/dumps
- tuts/python3/stdlib_module/pickle/load
- tuts/python3/stdlib_module/pickle/PickleBuffer
- tuts/python3/stdlib_module/pickle/PickleError
- tuts/python3/stdlib_module/pickle/Pickler
- tuts/python3/stdlib_module/pickle/PicklingError
- tuts/python3/stdlib_module/pickle/Unpickler
- tuts/python3/stdlib_module/pickle/UnpicklingError
Related notes
- tuts/python3/stdlib_module/pickle/dump Linked here; links to this page; shared tags: #pickle, #stdlib
- tuts/python3/stdlib_module/pickle/dumps Linked here; links to this page; shared tags: #pickle, #stdlib
- tuts/python3/stdlib_module/pickle/load Linked here; links to this page; shared tags: #pickle, #stdlib
- tuts/python3/stdlib_module/pickle/PickleBuffer Linked here; links to this page; shared tags: #pickle, #stdlib
- tuts/python3/stdlib_module/pickle Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/pickle/PickleError links to this page; shared tags: #pickle, #stdlib
- tuts/python3/stdlib_module/pickle/Pickler links to this page; shared tags: #pickle, #stdlib
- tuts/python3/stdlib_module/pickle/PicklingError links to this page; shared tags: #pickle, #stdlib
- tuts/python3/stdlib_module/pickle/Unpickler links to this page; shared tags: #pickle, #stdlib
- tuts/python3/stdlib_module/pickle/UnpicklingError links to this page; shared tags: #pickle, #stdlib