This prints out the last line of the file then stops. A new reading will be coming in a 1/2 second, but the program has already stopped. This is a live file with a new reading every 1/2 second. How do I get it to keep printing each new line?
with open('putty.log', 'rb') as fh:
for line in fh:
p = line.split(' ')
first = next(fh).decode()
fh.seek(-1024, 2)
last = fh.readlines()[-1].decode()
print last