Beginning Python

Starting with creating our data file data.txt:

data.txt
12
54
7
332
54
1
0

We then write a short script to open the data file, loop over its lines and print each in-turn. The only thing that has been changed here is the argument being passed to open():

file.py
with open("data.txt") as f:
    for line in f:
        print(line, end="")
$
python file.py
12
54
7
332
54
1
0