I have this assignment where I write certain lines from an input file. These lines I'm looking for in this case is only identified by its following line ("EOL"). It goes like (shortened):
while True:
line = infile.readlines()
if not line:
break
linesplit = line.split(",")
line = line[:-1]
if line startswith("Line"):
write stuff
if line startswith("$GPGGA"):
calculate and write stuff
if line startswith("EOL")
outfile.write(i really need the line previous to this one here somehow)
outfile.write(line + "\n")