Understanding tempfile.TemporaryFile
Steven D'Aprano
steven at REMOVE.THIS.cybersource.com.au
Thu Dec 27 22:36:19 EST 2007
More information about the Python-list mailing list
Thu Dec 27 22:36:19 EST 2007
- Previous message (by thread): Understanding tempfile.TemporaryFile
- Next message (by thread): Understanding tempfile.TemporaryFile
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, 27 Dec 2007 21:17:01 -0600, Shane Geiger wrote: > import tempfile > tmp = tempfile.mktemp() > > import os > os.remove(tmp) Not only does that not answer the Original Poster's question, but I don't think it does what you seem to think it does. >>> tmp = tempfile.mktemp() >>> tmp '/tmp/tmpZkS0Gj' >>> type(tmp) <type 'str'> >>> import os >>> os.remove(tmp) Traceback (most recent call last): File "<stdin>", line 1, in <module> OSError: [Errno 2] No such file or directory: '/tmp/tmpZkS0Gj' You might like to read help(tempfile.mktemp). (By the way... the whole point of using tempfile is to avoid needing to delete the file by hand afterwards.) -- Steven
- Previous message (by thread): Understanding tempfile.TemporaryFile
- Next message (by thread): Understanding tempfile.TemporaryFile
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list