I am trying to determine the best way to handle getting rid of newlines when reading in newline delimited files in Python.
What I\'ve come up with is the following c
Just use generator expressions:
blahblah = (l.rstrip() for l in open(filename)) for x in blahblah: print x
Also I want to advise you against reading whole file in memory -- looping over generators is much more efficient on big datasets.