The best way to read lines from a text file today is to not read it explicitly at all:
instead, open the file within an iteration context such as a forloop or list comprehension, and let the iteration tool automatically scan one line at a time by
running the file’s nextmethod on each iteration. This approach is generally best
in terms of coding simplicity, execution speed, and memory space requirements.