File descriptor to file object
Robert Kern
robert.kern at gmail.com
Mon Jun 14 15:05:32 EDT 2010
On 6/14/10 9:57 AM, 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?
Thomas Jollans' advice is likely best, but to answer your specific question, use
os.fdopen() to make a file object corresponding to the file descriptor.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Python-list
mailing list