On this page
marshal.load
Prev: marshal.dumps | Up: marshal | Next: marshal.loads
Rel: marshal.dump, marshal.dumps, marshal.loads
Ref: docs.python.org — marshal.load
Tags: #public #python3 #stdlib #marshal
Import
import marshal
from marshal import load
Signature & Overview
marshal.load(file, /, *, allow_code=True)
Read one value from the open file and return it.
Usage
import io
import marshal
buf = io.BytesIO(marshal.dumps((10, 20)))
assert marshal.load(buf) == (10, 20)
Gotchas
- Never load untrusted
.pycormarshalstreams—malformed bytes can crash the interpreter.
REPL Inspect
from marshal import load
help(load)
Linked from
Related notes
- tuts/python3/stdlib_module/marshal/dump Linked here; links to this page; shared tags: #marshal, #stdlib
- tuts/python3/stdlib_module/marshal/dumps Linked here; links to this page; shared tags: #marshal, #stdlib
- tuts/python3/stdlib_module/marshal/loads Linked here; links to this page; shared tags: #marshal, #stdlib
- tuts/python3/stdlib_module/marshal Linked here; links to this page; shared tags: #stdlib
- tuts/c/stdlib shared tags: #stdlib
- tuts/c/stdlib/assert shared tags: #stdlib
- tuts/c/stdlib/assert/assert shared tags: #stdlib
- tuts/c/stdlib/assert/static_assert shared tags: #stdlib
- tuts/c/stdlib/ctype shared tags: #stdlib
- tuts/c/stdlib/ctype/isalpha shared tags: #stdlib