Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tempfile
- import os
- tempfile = tempfile.mktemp()
- print "tempfile", "=>", tempfile
- file = open(tempfile, "w+b")
- file.write("*" * 1000)
- file.seek(0)
- print len(file.read()), "bytes"
- file.close()
- try:
- # must remove file when done
- os.remove(tempfile)
- except OSError:
- pass
- ## tempfile => C:\TEMP\~160-1
- ## 1000 bytes
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement