Skip to content

Chapter 13: Serializing Python Objects #15

@joshuamabina

Description

@joshuamabina

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

  1. What can you Pickle?
  2. The pickle module takes a Python data structure and saves it to a file. Discuss the caveats.
  3. Not every Python data structure can be serialized by the pickle module. Discuss why.
  4. Demonstrate saving data to a pickle file.
  5. Demonstrate loading data from a pickle file
  6. Demonstrate pickling without a file
  7. Demonstrate how one can use pickletools to debug a pickle file
  8. Demonstrate, data serialization for each python-specific datatypes to JSON

Metadata

Metadata

Assignees

Labels

class notesNew class notes or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions