First page Back Continue Last page Overview Graphics

Using readline()

Empty lines contain at least a ā€œ\nā€, so this script loops over the whole file.

fh = open("yellow_snow.txt")

line = "no line"

while line:

line = fh.readline()

print(line.rstrip())

fh.close()