Using next
or readlines
etc, is not necessary. As the documentation says: "For reading lines from a file, you can loop over the file object. This is memory efficient, fast, and leads to simple code".
Here's an example:
with open('/path/to/file') as myfile:
for line in myfile:
print(line)