Right way to io.open(...) an existing file object in Python 2.7?
Skip Montanaro
skip.montanaro at gmail.com
Tue Jan 16 13:02:30 EST 2018
>> I don't see any sort of "fdopen" or "freopen" equivalent mentioned in the io
>> module documentation. Is this possible in a clean way?
>>
>
> There is an os.fdopen(), so maybe
>
> newf = os.fdopen(fp.fileno())
Correct, but that just returns another File object which will still
lack the API provided by io.IOBase. I'm talking Python 2.7 here. In
Python 3.x, all I/O is mediated by that API.
Skip
More information about the Python-list
mailing list