#Line by line

with open("myfile.txt") as file:
    for line in file:
        print(line)

#With line number

file = open('myfile.txt', 'r')
for i, line in enumerate(file, start=1):
    print("Number %s: %s" % (i, line))
Comments