Files should be iterable on their own: filehandle = open('/path/to/foo.txt') for line in filehandle: # do something... But you could also do a generic lines = filehandle.readlines(), which returns a list of all lines in the file, but that's a bit memory hungry.