I know that reading a specific line is possible with:
i = 0
while True:
with open("file.txt") as f:
f = f.readlines()[i]
i += 1
So I wondered if there is any responsive way to write to a specific line, but this doesn't seem to be working:
i = 0
while True:
with open("file.txt", 'w') as f:
f = f.writelines(str(episode))[i]
i += 1
But this alone does work:
with open("file.txt", 'w') as f:
f = f.writelines(str(episode))