There are two aspects to preserving data for long-term use: converting the data back and forth between the object in-memory and the storage format, and working with the storage of the converted data. The standard library includes a variety of modules that handle both aspects in different situations.
Two modules convert objects into a format that can be transmitted or stored (a process known as serializing). It is most common to use
pickle (page 396) for persistence—it is integrated with some of the other standard library modules that actually store the serialized data, such as
json is more frequently used for web-based applications, however, since it integrates better with existing web service ...