Tail...

Dave Brueck dave_brueck at hotmail.com
Mon May 7 09:21:28 EDT 2001


> Magnus Heino <magnus.heino at rivermen.se> writes:
>
> > How can I know if a file changes?
> >
> > Just like the tail command, I want to know when lines are added to a
file,
> > and be able to read them.

Use os.stat to track the last modification time of the file (and to detect
when it changes):

import os, stat
os.stat(somefile)[stat.ST_MTIME]

-Dave





More information about the Python-list mailing list