os.tmpfile()
Steve Purcell
stephen_purcell at yahoo.com
Tue Feb 27 03:33:56 EST 2001
Kenneth Anderson wrote:
> >>> 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 '
Not sure about this, but you could try 'tempfile.mktemp' to get a unique
filename, then explicitly open it yourself to see if the results are any
different.
> any notions about this. I would really prefer not to write a file
> but rather just write the data to a file object.
Maybe you just need to use the StringIO (or cStringIO) module if you want
an in-memory file-like object?
-Steve
--
Steve Purcell, Pythangelist
Get testing at http://pyunit.sourceforge.net/
Get servlets at http://pyserv.sourceforge.net/
"Even snakes are afraid of snakes." -- Steven Wright
More information about the Python-list
mailing list