Pickle Problem
andrew cooke
andrew at acooke.org
Tue Mar 3 06:50:32 EST 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)
f.close()
for an explanation of the "%" see
http://docs.python.org/library/stdtypes.html#index-1680
the '\n' is a newline character so that after each number a new line is
started.
andrew
> Thanks again,
>
> Fabien
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>
More information about the Python-list
mailing list