On this page
  1. marshal.dumps
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

marshal.dumps

Prev: marshal.dump | Up: marshal | Next: marshal.load
Rel: marshal.dump, marshal.load, marshal.loads
Ref: docs.python.org — marshal.dumps
Tags: #public #python3 #stdlib #marshal


Import

import marshal
from marshal import dumps

Signature & Overview

marshal.dumps(value, version=5, /, *, allow_code=True)

Return the bytes object that would be written to a file by dump(value, file).

Usage

import marshal

raw = marshal.dumps({"a": 1, "b": [2, 3]})
assert marshal.loads(raw) == {"a": 1, "b": [2, 3]}

Gotchas

REPL Inspect

from marshal import dumps
help(dumps)

Linked from

Related notes