I am trying to get a
to be the first line of the file
and b
to be the second.
This prints nothing.
f = open(filename)
line = f.readline().strip()
while line:
a = f.readline()
b = f.readline()
line = f.readline()
print(a)
print(b)
I want to assign specific lines to variables, not just read all of them.