Pickle Problem

andrew cooke andrew at acooke.org
Tue Mar 3 12:50:32 CET 2009

Fab86 wrote:
> I am wanting to store the integers in a file so that I can then run it
> through some software without having to edit it. Will json enable me
> to do this?

no.  ignore json - it is for something else entirely.

all you need to do is to write the numbers out to a file:

f = open('file.txt', 'w')
f.write('%d\n' % 123)
f.write('%d\n' % 456)

for an explanation of the "%" see

the '\n' is a newline character so that after each number a new line is


> Thanks again,
> Fabien
> --
> http://mail.python.org/mailman/listinfo/python-list

More information about the Python-list mailing list