title: How to read a file (or stdin) line by line in Python not waiting for reading entire file
body: <p>We have couple of huge files (greater than size of RAM) in disk. I want to read them line by line in python and output results in terminal. I have gone through [1] and [2], but I am looking for methods which do not wait till the entire file is read into memory.</p>
  
  <p>I would be using both of these commands:</p>
  
  <pre><code>cat fileName | python myScript1.py
  python myScript2.py fileName
  </code></pre>
  
  <p>[1] <a href="https://stackoverflow.com/questions/1450393/how-do-you-read-from-stdin-in-python">How do you read from stdin in Python?</a>
  [2] <a href="https://stackoverflow.com/questions/1589994/how-do-i-write-a-unix-filter-in-python">How do I write a unix filter in python?</a></p>