Is it possible to write the next line with this code? How to do that? I want to read (n) line then do math to write (n+1), with unlimited looping.
import time
def follow(thefile):
thefile.seek(0,2)
while True:
line = thefile.readline()
if not line:
time.sleep(0.1)
continue
yield line
if __name__ == '__main__':
logfile = open("myfile.txt","r+")
loglines = follow(logfile)
for line in loglines:
write.logfile ("5*2+1\n")