title: How to modify this code to read very large files?
body: <p>I currently have this code to read excel files:</p>
  
  <pre><code>f = open(filename, 'r')
  lines = f.readlines()
  f.close()
  </code></pre>
  
  <p>This works fine for most of the stuff I deal with, however, I now have a giant excel file and this no longer works. I have found this code, which should solve my issue, but I am not sure how to store all of the lines so I can downsample the original excel file. </p>
  
  <pre><code>with open(filename) as f:
  for line in f:
      &lt;do something with line&gt;
  </code></pre>
  
  <p>Is it possible in the above example to read all of the excel file and store it in</p>
  
  <pre><code>lines
  </code></pre>
  
  <p>To continue with my downsampling, so I don't need to modify more of my code (so take a line from the excel file, write it to lines, move onto the next, etc.)?</p>