efficient 'tail' implementation

Neal Becker ndbecker2 at gmail.com
Thu Dec 8 19:34:38 CET 2005

s99999999s2003 at yahoo.com wrote:

> hi
> I have a file which is very large eg over 200Mb , and i am going to use
> python to code  a "tail"
> command to get the last few lines of the file. What is a good algorithm
> for this type of task in python for very big files?
> Initially, i thought of reading everything into an array from the file
> and just get the last few elements (lines) but since it's a very big
> file, don't think is efficient.
> thanks

You should look at pyinotify.  I assume we're talking linux here.

More information about the Python-list mailing list