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

Giampaolo Rodolà g.rodola at gmail.com
Tue Nov 8 19:27:31 CET 2011


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/
>



More information about the Python-ideas mailing list