Re-read an open file Python
Either seek
to the beginning of the file
with open(...) as fin:
fin.read() # read first time
fin.seek(0) # offset of 0
fin.read() # read again
or open the file again (I'd prefer this way since you are otherwise keeping the file open for an hour doing nothing between passes)
with open(...) as fin:
fin.read() # read first time
with open(...) as fin:
fin.read() # read again
Putting this together
while True:
with open(...) as fin:
for line in fin:
# do something
time.sleep(3600)
You can move the cursor to the beginning of the file the following way:
file.seek(0)
Then you can successfully read it.