Reading a file that is changing and getting the new lines

Sean DiZazzo half.italian at gmail.com
Tue Dec 1 20:31:57 EST 2009


On Dec 1, 3:09 pm, Ouray Viney <ovi... at gmail.com> wrote:

> Problem:
> =========
> I want to read a ASCII text file that can have data appended to it.
>
> Example scenario:  As the python script is running a user/application
> adds new entries to the end of the test case file, example, adds the
> following to the file.

>
> Question:
> =========
> What is the best way to handle this type of scenario using python?

There was a thread regarding 'imitating "tail -f"' recently that you
might find useful.

The best approach IMO is this one: http://www.dabeaz.com/generators/follow.py

~Sean



More information about the Python-list mailing list