468,537 Members | 2,035 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,537 developers. It's quick & easy.

Understanding tempfile.TemporaryFile

Wondering if someone would help me to better understand tempfile. I
attempt to create a tempfile, write to it, read it, but it is not
behaving as I expect. Any tips?
>>x = tempfile.TemporaryFile()
print x
<open file '<fdopen>', mode 'w+b' at 0xab364968>
>>print x.read()
>>print len(x.read())
0
>>x.write("1234")
print len(x.read())
0
>>x.flush()
print len(x.read())
0

Dec 28 '07 #1
0 1464

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by marco | last post: by
1 post views Thread by Jonathan Wright | last post: by
1 post views Thread by Matt Garman | last post: by
5 posts views Thread by Gregory Piñero | last post: by
6 posts views Thread by James T. Dennis | last post: by
4 posts views Thread by billiejoex | last post: by
9 posts views Thread by billiejoex | last post: by
4 posts views Thread by samir.vds | last post: by
7 posts views Thread by byte8bits | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.