I am sorry if it's very basic or already asked before (I googled but couldn't find a simple & satisfactory explanation).
I want to know what sys.stdin.fileno() is?
I saw it in a code and didn't understand what it does. Here's the actual code block,
fileno = sys.stdin.fileno()
if fileno is not None:
new_stdin = os.fdopen(os.dup(fileno))
I just executed print sys.stdin.fileno() in my python command line and it returned 0.
I also searched google, and this (nullage.com) is the reference I could find, but it also only says,
fileno() -> integer "file descriptor".
This is needed for lower-level file interfaces, such os.read().
So, what exactly does it mean?
s hareimprove this question
asked Aug 25 '15 at 8:50