How to streamingly read text file and display whenever updated text

Mark Lawrence breamoreboy at yahoo.co.uk
Sat Oct 5 07:08:18 EDT 2013


On 05/10/2013 12:02, Joost Molenaar wrote:
> A bit of googling found me this:
> http://www.linux-support.com/cms/implementation-of-tail-in-python/
>
> import time
> import sys
>
> def tail_f(file):
>    interval = 1.0
>    while True:
>      where = file.tell()
>      line = file.readline()
>      if not line:
>        time.sleep(interval)
>        file.seek(where)
>      else:
>        yield line
>

In future could you please quote some context so that it's easier for us 
mere mortals to follow the thread, thanks in anticipation.

-- 
Roses are red,
Violets are blue,
Most poems rhyme,
But this one doesn't.

Mark Lawrence




More information about the Python-list mailing list