The output from pickle
is non-human readable, and thus, non editable.
I'm looking for something which can do exactly the same (or very close to) pickle, whereby it can dump out all the python understandable objects into a file, and later on be able to directly load it back.
Look no further, go for json. json is a text format and can be edited easily. Out of the box you can use it for serializing objects of Python's built-in types like lists, dictionaries, strings, etc., but there are ways to serialize objects of your own classes to json as well, see here: How to make a class JSON serializable
hmmm ........ I find that this somewhat kinda work for me.
Dumping Object to File
import pprint
f = open('a.txt', 'w')
pprint.pprint(myobject, f)
f.close()
Loading object from file
import pprint
f = open('a.txt')
lines = f.read()
myobject = eval(lines)
f.close()
If you want to have all the flexibility of pickle, I would say the most sensible thing to do is to create an specific format which can help you.
I do not know any tool which would be as powerful as pickle and yet would generate editable exported data, but you can create your own. Some time ago, I created a toy module which would wrap a Python module so it could send and receive XML messages, mostly to show to a friend how it is easy to work with Python :) It is not exactly what you are looking for but can be a starting point so take a look at it.
(BTW, I would be happy to know some other tools which do the same thing, in a better way. It should exist, I believe I just didn't find it yet.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With