title: Python module import Error, Infinite loop
body: <p><a href="https://i.stack.imgur.com/cQ6hQ.png" rel="nofollow noreferrer">enter image description here</a></p>
  <ol>
  <li>Error code</li>
  </ol>
  <pre class="lang-py prettyprint-override"><code>import sys
  from sys import stdin
  
  sys.stdin = open(&quot;input.txt&quot;, &quot;r&quot;)
  
  input = stdin.readline
  
  n = int(input())
  </code></pre>
  <ol start="2">
  <li>Pass code</li>
  </ol>
  <pre class="lang-py prettyprint-override"><code>from sys import stdin
  
  stdin = open(&quot;input.txt&quot;, &quot;r&quot;)
  
  
  input = stdin.readline
  
  n = int(input())
  </code></pre>
  <p>i'm not good at English! but i'm curious.
  Can you see the Problem in the picture?</p>
  <ol>
  <li>Infinite loop after using the sys module!!!</li>
  </ol>
  <ul>
  <li><code>import sys</code> &gt;&gt;&gt; <code>sys.stdin</code></li>
  <li><code>from sys import stdin</code> &gt;&gt;&gt; <code>input = stdin.readline</code></li>
  </ul>
  <ol start="2">
  <li>nice pass code</li>
  </ol>
  <ul>
  <li><code>from sys import stdin</code> &gt;&gt;&gt; <code>stdin</code></li>
  <li><code>from sys import stdin</code> &gt;&gt;&gt; <code>stdin.readline</code></li>
  </ul>
  <ol start="3">
  <li>Why is there an infinite loop here? Is it a module crash?</li>
  </ol>