On 15/06/2011 13:51, Jacob Kruger wrote:
I know I can do a version of manual import/export process to do
something like either backup all relevant attributes of some or other
object to something like a CSV, or XML string rendition, and then
save that to a file easily enough, but just wondering if there's any
simpler way to render an object/class instance to a string rendition,
and then to maybe reiterate the original object later on..?
TIA (and not too important, but just wondering)
The standard Python way is the pickle module:
http://docs.python.org/library/pickle.html
If your objects are very simple (basically core Python objects)
then marshal is lighter and faster:
http://docs.python.org/library/marshal.html
There are definitely other options out there. The stdlib has
recently included JSON support:
http://docs.python.org/library/json.html
and there are definitely third-party options as well. Just
Google for "python object serialisation" or something.
TJG
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32