Re: Store multiple dictionaries in a file
- From: Jeremy Sanders <jeremy+complangpython@xxxxxxxxxxxxxxxxx>
- Date: Thu, 30 Jun 2005 13:00:26 +0100
Philipp H. Mohr wrote:
> I would like to store multiple dictionaries in a file, if possible one per
> line. My code currently produces a new dictionary every iteration and
> passes it on to another peace of code. In order to be able to re-run some
> experiments at a later date I would like to store every dictionary in the
> same file.
> I looked at pickel, but that seems to require a whole file for each
> dictionary.
If you're not worried about security, you could write the repr() of each
dict to the file and get the values back by using the eval() function.
repr() writes onto one line.
If you're storing types without repr() representations this will not work.
Jeremy
--
Jeremy Sanders
http://www.jeremysanders.net/
.
- Follow-Ups:
- Re: Store multiple dictionaries in a file
- From: Philipp H. Mohr
- Re: Store multiple dictionaries in a file
- References:
- Store multiple dictionaries in a file
- From: Philipp H. Mohr
- Store multiple dictionaries in a file
- Prev by Date: Re: sys.ps2
- Next by Date: Re: How to compare two directories?
- Previous by thread: Re: Store multiple dictionaries in a file
- Next by thread: Re: Store multiple dictionaries in a file
- Index(es):
Relevant Pages
|