I like to store my data after a longish python program as dictionaries in a new script. This then allows me to import the program (and hence data) easily for further manipulation.
I write something like this (an old example):
file = open(p['results']+'asa_contacts.py','w')
print>>file, \
'''
\'''
This file stores the contact residues according to changes in ASA
as a dictionary
\'''
d = {}
'''
followed by a lot of faffing around entering the dictionary code as a string:
print>>file, 'd[\'%s\'] = {}' %st
I was wondering if there was a module which did this automatically as it would save me a lot of time.
Thank you
Edit: it may be useful to know that these dictionaries are usually several layers deep like this one I’m using today:
d[ratio][bound][charge] = a_list
I am not sure if this is what you are looking for but try the inbuilt function repr.