[BangPypers] How to read a file from bottom

Vimal Menon vimalmenon at yahoo.com
Fri Apr 4 20:58:25 CEST 2008

Hi Arivoli,

Theres a dirty trick ;) (by running a command).. If u r on a linux machine u can use the tail command .. tail -100 <filename> would give u the last 100 lines of <filename> .. 
(or do a seek and read) 
or u can try this http://code.google.com/p/pytailer/


----- Original Message ----
From: Arivoli S <arivoli at gmail.com>
To: bangpypers at python.org
Sent: Friday, April 4, 2008 11:29:40 PM
Subject: [BangPypers] How to read a file from bottom

Hi everybody,
   i have a log file which will grow everyday, so the size will be nearly 500MB. i am keep on inserting a line one by one in the file.
so the latest one will be in the bottom. I need to get latest 100 lines(lines from bottom). Any idea how to read lines from bottom in a text file?

I tried storing into a list line by line, and iterating from bottom , but it seems to be slow. Is there any better way to do this?


You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/bangpypers/attachments/20080404/44ff14b1/attachment.htm 

More information about the BangPypers mailing list