I have a python
class that contains many objects -- some are data structures (lists
, dicts
etc) and some are handlers to other classes (that also contain other data structures...).
Rather than using pickle
to save the entire class & its contents, I was wondering if there is a way to serialize
the data of several desired objects and save them (ONLY them) in a binary file?
For example, suppose that I have the following 2 python objects:
myList = [1, 2, 3, 4, 5]
myDict = {'a' : 14, 'b' : 5, 'c' : 65}
What is the best way to save the contents of BOTH of these python
objects in a binary file? ideally, I'd like to save both objects in the same binary file, and be able to load the data later on.