I'm using tempfile. The doc says it is opened 'w+b' so that it can be read and written without closing and reopening.
But, for the life of me, I can't find any way to rewind it so I can read what I wrote.
3import tempfile import os fd, name = tempfile.mkstemp() os.write(fd, 'foo')
0Los.lseek(fd, 0, 0)
os.read(fd, 10)
'foo'
tempfile.mkstemp gives me the file descriptor. Is there a way to make a file object from a file descriptor?
Not that I can see: http://docs.python.org/lib/os-fd-ops.html
... except maybe this, which is not quite the same:
3import tempfile import os fd, name = tempfile.mkstemp() os.write(fd, 'foo')
f = open(name) f.read()
'foo'
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
_______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
