File descriptor to file object
Thomas Jollans
thomas at jollans.com
Mon Jun 14 11:07:36 EDT 2010
On 06/14/2010 04:57 PM, Nathan Huesken wrote:
> Hi,
>
> tempfile.mkstemp returns a file name and a file descriptor (as returned
> by os.open). Can I somehow convert this descriptor to a file object?
the builtin open function should work.
http://docs.python.org/py3k/library/functions.html#open
Also, it's probably better to just use a tempfile.TemporaryFile or
tempfile.NamedTemporaryFile instead of directly using mkstemp.
--
Thomas
More information about the Python-list
mailing list