#from __future__ import with_statement # is not needed in Python 3.6 with open(filename, 'r') as f: for line in f: pass # process line, includes newline