On 01/26/2011 04:59 AM, Xavier Heruacles wrote:
I have do some log processing which is usually huge. The
length of each line is variable. How can I get the last line??
Don't tell me to use readlines or something like linecache...
I wrote a modestly tested version (including missing
terminal-EOL, files with no newlines, and empty files) at
http://www.mail-archive.com/python-list@python.org/msg226537.html
which minimizes the number of seeks (reading chunks rather than
seeking for every character as you work backwards).
You might find it useful.
-tkc
--
http://mail.python.org/mailman/listinfo/python-list