Hello,
this is the solution I went for, as I am indeed not concernt about
security and the implementation is straight forward.
Thank you,
Phil
> 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.
> r
You might want to take a look at the shelve module.
-Larry
Philipp H. Mohr wrote:
> Hello,
>
> 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 b
[John Machin]
|
| bruno modulix wrote:
| > Philipp H. Mohr wrote:
|
| >>My code currently produces a new dictionary every iteration and
| >>passes it on to another peace of code.
| >
| >
| > May this code rest in piece
|
| Perhaps it's the piece of code that passeth all understanding?
Th
bruno modulix wrote:
> Philipp H. Mohr wrote:
>>My code currently produces a new dictionary every iteration and
>>passes it on to another peace of code.
>
>
> May this code rest in piece
Perhaps it's the piece of code that passeth all understanding?
--
http://mail.python.org/mailman/listinfo
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 stor
Thank you for you answer.
> > I would like to store multiple dictionaries in a file, if possible one per
> > line.
>
> Why "one per line" ?
I agree with you that it sounds like nasty code :-) but there is a good
reason for doing it this way - I think. My code collects data (attributes)
of its cu
How so?
>>> import cPickle as cp
>>> f=open("/tmp/test.pck", "wb")
>>> cp.dump(dict(a=1), f)
>>> cp.dump(dict(b=1), f)
>>> f.close()
>>> f=open("/tmp/test.pck", "rb")
>>> cp.load(f)
{'a': 1}
>>> cp.load(f)
{'b': 1}
>>> cp.load(f)
Traceback (most recent call last):
File "", line 1, in ?
EOFError
Philipp H. Mohr wrote:
> Hello,
>
> I would like to store multiple dictionaries in a file, if possible one per
> line.
Why "one per line" ?
> My code currently produces a new dictionary every iteration and
> passes it on to another peace of code.
May this code rest in piece
> In order to be