How to read line by line out of a file

43 Views Asked by At

input file:

1
2
3
4
5

what I have at this time:

filename=input("Please enter the filename or path: ")
with open(filename, 'r') as file:
    filecontents=tuple(map(int, file.read().split()))

print(filecontents)

output: (1,2,3,4,5)

intended output:

1
2
3
4
5
0

There are 0 best solutions below