title: What is sys.stdin.fileno() in python
body: <p>I am sorry if it's very basic or already asked before (I googled but couldn't find a simple &amp; satisfactory explanation).</p>
  <p>I want to know what <code>sys.stdin.fileno()</code> is?</p>
  <p>I saw it in a code and didn't understand what it does. Here's the actual code block,</p>
  <pre><code>fileno = sys.stdin.fileno()
  if fileno is not None:
      new_stdin = os.fdopen(os.dup(fileno))
  </code></pre>
  <p>I just executed <code>print sys.stdin.fileno()</code> in my python command line and it returned <code>0</code>.</p>
  <p>I also searched google, and <a href="http://nullege.com/codes/search/sys.stdin.fileno" rel="noreferrer">this (nullage.com)</a> is the reference I could find, but it also only says,</p>
  <blockquote>
  <p>fileno() -&gt; integer &quot;file descriptor&quot;.</p>
  <p>This is needed for lower-level file interfaces, such os.read().</p>
  </blockquote>
  <p>So, what exactly does it mean?</p>