Re: dump a multi dimensional dictionary

2013-07-26 Thread Steven D'Aprano
On Fri, 26 Jul 2013 13:21:47 -0700, cerr wrote: > or should I just write my own dump function that can hanle thiS? > > Please advise! Given the choice between reading the documentation to pickle.dump: help(pickle.dump) or spending the next month writing a replacement for pickle, testing it,

Re: dump a multi dimensional dictionary

2013-07-26 Thread Chris Angelico
On Fri, Jul 26, 2013 at 9:21 PM, cerr wrote: > >>> mylist = [] > >>> mydict = {} > >>> mylist = '1','2' Side point: mylist is no longer a list, it's a tuple. I don't think pickle has problems with tuples, but it's worth noting that difference. ChrisA -- http://mail.python.org/mailm

RE: dump a multi dimensional dictionary

2013-07-26 Thread Prasad, Ramit
cerr wrote: > Hi, > > Can I somehow use pickle.dump() to store a dictionary of lists to a file? > I tried this: > > >>> import pickle > >>> mylist = [] > >>> mydict = {} > >>> mylist = '1','2' > >>> mydict['3'] = mylist > >>> fhg = open ("test", 'w') > >>> pickle.dump(

Re: dump a multi dimensional dictionary

2013-07-26 Thread John Gordon
In cerr writes: > Can I somehow use pickle.dump() to store a dictionary of lists to a file? > I tried this: > >>> import pickle > >>> mylist = [] > >>> mydict = {} > >>> mylist = '1','2' > >>> mydict['3'] = mylist > >>> fhg = open ("test", 'w') > >>> pickle.dump(fhg