C
cerr
Hi,
Can I somehow use pickle.dump() to store a dictionary of lists to a file?
I tried this:
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/pickle.py", line 1370, in dump
Pickler(file, protocol).dump(obj)
File "/usr/lib/python2.7/pickle.py", line 203, in __init__
self.write = file.write
AttributeError: 'dict' object has no attribute 'write'{'3': ('1', '2')}
or should I just write my own dump function that can hanle thiS?
Please advise!
Thanks,
Ron
Can I somehow use pickle.dump() to store a dictionary of lists to a file?
I tried this:
Traceback (most recent call last):import pickle
mylist = []
mydict = {}
mylist = '1','2'
mydict['3'] = mylist
fhg = open ("test", 'w')
pickle.dump(fhg,mydict)
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/pickle.py", line 1370, in dump
Pickler(file, protocol).dump(obj)
File "/usr/lib/python2.7/pickle.py", line 203, in __init__
self.write = file.write
AttributeError: 'dict' object has no attribute 'write'{'3': ('1', '2')}
or should I just write my own dump function that can hanle thiS?
Please advise!
Thanks,
Ron