tail -f with python

Roy Marteen rm at no-mail.com
Sat Aug 3 20:41:26 CEST 2002


How can I write in Python something like 'tail -f filename'? I mean, when
there is an append to the file, it will be displayed real time.

I tried this:

while 1:
    line = open('test', 'r').readline()
    print line

But it keeps looping, eventhough there is no change (append) in file
'test'. Please help, and thanks very much.

More information about the Python-list mailing list