concept pickle in category python

appears as: pickle
Hello World! Third Edition

This is an excerpt from Manning's book Hello World! Third Edition.

Luckily, Python has a way to make storing things like lists and objects easier. It’s a Python module called pickle. That’s kind of a funny name, but think about it: pickling is a way of preserving food so you can use it later. In Python, you “pickle” your data so you can save it on disk and use it later. Makes sense!

Listing 22.6. Using pickle to store a list to a file
import pickle
my_list  = ['Fred', 73, 'Hello there', 81.9876e-13]
pickle_file = open('my_pickled_list.pkl', 'wb')
pickle.dump(my_list, pickle_file)
pickle_file.close()