Python supplies a number of modules dealing with I/O operations that serialize (save) entire Python objects to various kinds of byte streams and deserialize (load and recreate) Python objects back from such streams. Serialization is also known as marshaling.
marshal module supports the specific serialization tasks needed to save and reload compiled Python files (.pyc and .pyo).
marshal handles only fundamental built-in data types:
None, numbers (
complex), strings (plain and Unicode), code objects, and built-in containers (
dict) whose items are instances of elementary types.
marshal does not handle sets nor user-defined types and classes.
marshal is faster than other serialization modules, and is the one such module that supports code objects. Module
marshal supplies the following functions.