I've got 20 variables which are named line1
, line2
, line3
, ..., up to line20
.
Is there a way in Python to use a for
loop to reference each of these variables in sequence, i.e., iterate through them? Something to this effect:
for i in range(1, 21):
print(line + str(i))
Although I know that's wrong.