title: Best method for reading newline delimited files and discarding the newlines?
body: <p>I am trying to determine the best way to handle getting rid of newlines when reading in newline delimited files in Python.</p>
  <p>What I've come up with is the following code, include throwaway code to test.</p>
  <pre><code>import os
  
  def getfile(filename,results):
     f = open(filename)
     filecontents = f.readlines()
     for line in filecontents:
       foo = line.strip('\n')
       results.append(foo)
     return results
  
  blahblah = []
  
  getfile('/tmp/foo',blahblah)
  
  for x in blahblah:
      print x
  </code></pre>