Pickle Problem

andrew cooke andrew at acooke.org
Tue Mar 3 13:00:43 CET 2009


maybe the following are simpler as they use print


if you are using python 2.6 or python 3:

>>> from __future__ import print_function
>>> f = open('myfile.txt', 'w')
>>> print(123, file=f)
>>> print(456, file=f)
>>> f.close()


alternatively, in python 2.5 or 2.6:

>>> f = open('myfile.txt', 'w')
>>> print >> f, 123
>>> print >> f, 456
>>> f.close()


andrew






More information about the Python-list mailing list