Chapter 7. Data Persistence and Exchange

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 shelve. json is more frequently used for web-based applications, however, since it integrates better with existing web service ...

Get The Python 3 Standard Library by Example, Second 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.