how to read the last line of a huge file???

kost BebiX k.bx at ya.ru
Wed Jan 26 16:40:01 EST 2011


26.01.2011, 12:59, "Xavier Heruacles" <xheruacles at gmail.com>:
> 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... --
> http://mail.python.org/mailman/listinfo/python-list

Well, it's very simple. Don't store the whole log in one file. Create new one and archive the old one every night. You will also get a lot of free space this way.
Or store it in some MongoDB's capped collection. It's fast and queryable (if you need).
Good luck!

-- 
jabber: k.bx at ya.ru



More information about the Python-list mailing list