Do you think serializing data structures is simple? Please, think again!
Spoilers...
import pickle, json
# make serializing data, great again!
See source: https://diveintopython3.net/serializing.html
Review Questions
- What can you Pickle?
- The pickle module takes a Python data structure and saves it to a file. Discuss the caveats.
- Not every Python data structure can be serialized by the pickle module. Discuss why.
- Demonstrate saving data to a pickle file.
- Demonstrate loading data from a pickle file
- Demonstrate pickling without a file
- Demonstrate how one can use
pickletools to debug a pickle file
- Demonstrate, data serialization for each python-specific datatypes to JSON
Do you think serializing data structures is simple? Please, think again!
Spoilers...
See source: https://diveintopython3.net/serializing.html
Review Questions
pickletoolsto debug a pickle file