Python - How do I convert an OS-level handle to an open file to a file object?This my Answer to the stackoverflow question: Python - How do I convert "an OS-level handle to an open file" to a file object?:
You can use
to write to the handle.
If you want to open the handle for writing you need to add the "w" mode
f = os.fdopen(tup, "w") f.write("foo")