We can read a file line by line in Python as -
>>> with open("file.txt", "r") as file: ... lines = file.readlines() ... >>> for line in lines: ... print("{}".format(line.strip())) ... Line 1 Line 2 Line 3
Source: GeeksForGeeks
Last updated 3 months ago