os.tmpfile()

Kenneth Anderson anderson at pha.jhu.edu
Mon Feb 26 13:30:08 EST 2001


Hi

i am trying to use the os.tmpfile() method to create a file object for
writing,
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.

thanks!

Ken Anderson
JHU

--
===================================================
...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