You can use open() method in Python to open a file and then read the file line by line using a for loop as shown in the below example –
1 2 3 |
with open(filename) as file: for line in file: print(line.rstrip()) |
You can use open() method in Python to open a file and then read the file line by line using a for loop as shown in the below example –
1 2 3 |
with open(filename) as file: for line in file: print(line.rstrip()) |