So I've seen this code;
with open(fname) as f:
content = f.readlines()
in another question. I just need some confirmation on how it works.
If I were to have a file named normaltrack.py
which contains code;
wall 0 50 250 10
wall 0 -60 250 10
finish 200 -50 50 100
I should have a list called wall = []
and have the opening code as;
with open(normaltrack.py) as f:
wall = f.readlines()
to open the file and store the lines of code that start with "wall" into the list?
Do I always have the change the "fname" everytime I want to open a different file? Or is there a way to do it from the interpreter? Such as python3 assignment.py < normaltrack.py ?