Kenneth Anderson anderson at pha.jhu.edu
Mon Feb 26 19:30:08 CET 2001


i am trying to use the os.tmpfile() method to create a file object for
but i am seeing weird behaviour that i certainly don't expect:

>>> import os
>>> f1 = os.tmpfile()
>>> f1
<open file '<tmpfile>', mode 'w+' at eed68>
>>> f1.readlines()
>>> f1.write('check')
>>> f1.readlines()

'\000\000\000\000\000\000\000\000\...long, long list of \000   '

Nothing is the FAQ about tmpfile().

any notions about this.  I would really prefer not to write a file
but rather just write the data to a file object.


Ken Anderson

...and for lunch, Ken stops by the side of the road
and rubs gravel into his hair.

More information about the Python-list mailing list