[Python-ideas] shutil.tail(file, lines)

John O'Connor jxo6948 at rit.edu
Tue Nov 8 19:30:16 CET 2011


There is also a more general solution: the reverse file iterator, started
here but never
finished: http://bugs.python.org/issue1677872

- John


On Tue, Nov 8, 2011 at 1:27 PM, Giampaolo Rodolà <g.rodola at gmail.com> wrote:

> Edit: after a better look it seems data gets stored in memory
> increasingly. We can see whether that is fixable someway though.
>
> --- Giampaolo
> http://code.google.com/p/pyftpdlib/
> http://code.google.com/p/psutil/
>
>
> 2011/11/8 Giampaolo Rodolà <g.rodola at gmail.com>:
> > This is something I need to do every once in a while and I think it
> > would be a good addition for shutil module.
> > Here:
> >
> http://stackoverflow.com/questions/136168/get-last-n-lines-of-a-file-with-python-similar-to-tail
> > ...is a nice implementation which appears to be a good compromise in
> > terms of speed and memory consumption (it reads the file in chunks, no
> > more than 1024 bytes per-read).
> >
> > What do you think?
> >
> > --- Giampaolo
> > http://code.google.com/p/pyftpdlib/
> > http://code.google.com/p/psutil/
> >
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20111108/3c866a91/attachment.html>


More information about the Python-ideas mailing list