title: How to write Python scripts that work with Linux pipes?
body: <p>In <code>speaker.py</code>, I use <code>print</code> to output text to <code>STDOUT</code>:</p>
  
  <pre><code>import time
  
  while True:
      time.sleep(1)
      print("hello")
  </code></pre>
  
  <p>And in <code>listener.py</code>, I use <code>input</code> to read from <code>STDIN</code>:</p>
  
  <pre><code>while True:
      line = input()
      if not line:
          break
      print(line)
  </code></pre>
  
  <p>I'm trying to connect these two scripts with a pipe:</p>
  
  <p><code>python speaker.py | python listener.py</code></p>
  
  <p>But <code>listner.py</code> output nothing.</p>
  
  <p>What's wrong?</p>