O'Reilly logo

Python 3 Object Oriented Programming by Dusty Phillips

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Storing objects

Nowadays, we take the ability to write data to a file and retrieve it at an arbitrary later date for granted. As convenient as this is (imagine the state of computing if we couldn't store anything!), we may often find ourselves converting data we have stored in a nice object or design pattern in memory into some kind of clunky text or binary format for storage.

The Python pickle module, allows us to store objects directly in a special object storage format. It essentially converts an object (and all the objects it holds as attributes) into a format that can be stored in a file or file-like object or a string of bytes that we can do whatever we want with.

For basic work, the pickle module has an extremely simple interface. It is ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required