marshal

The marshal module is used to serialize Python objects in an “undocumented” Python-specific data format. marshal is similar to the pickle and shelve modules, but it is less powerful and intended for use only with simple objects. It shouldn’t be used to implement persistent objects in general (use pickle instead).

dump(value, file [, version])

Writes the object value to the open file object file. If value is an unsupported type, a ValueError exception is raised. version is an integer that specifies the data format to use. The default output format is found in marshal.version and is currently set to 1. Version 0 is an older format used by earlier versions of Python.

dumps(value [, version])

Returns the string written by the dump() function. ...

Get Python: Essential Reference, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.