Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- C:Documents and SettingsAdministrator>python
- Python 2.6.1 (r261:67517, Dec 4 2008, 16:51:00) [MSC v.1500 32 bit (Intel)] on win32
- Type "help", "copyright", "credits" or "license" for more information.
- >>> import tempfile
- >>> __, filename = tempfile.mkstemp()
- >>> print filename
- c:docume~1admini~1locals~1temptmpm5clkb
- >>> fptr = open(filename, "wb")
- >>> fptr.write("Hello World!")
- >>> fptr.close()
- >>> import os
- >>> os.remove(filename)
- Traceback (most recent call last):
- File "<stdin>", line 1, in <module>
- WindowsError: [Error 32] The process cannot access the file because it is being used by
- another process: 'c:\docume~1\admini~1\locals~1\temp\tmpm5clkb'
- >>> __, filename = tempfile.mkstemp()
- >>> fptr= os.fdopen(__)
- fh, filename = tempfile.mkstemp()
- ...
- os.close(fh)
- os.remove(filename)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement