Danny.... This is a very clean way to get the last line.
 
Thanks.
Regards,
Asrarahmed

 
On 10/19/06, Danny Yoo <[EMAIL PROTECTED]> wrote:
> first count the number of lines in the file by using a loop. Use a
> second loop and when teh counter reaches the num_of_lines values: take
> the line.
>
> Is there any other way to do it??

Yes, there's a way to do it in one pass: you can keep track of the very
last line you've read from the file at any given time.  As soon as you hit
the end of the file, the auxiliary "last seen line" must be the last line.



--
To HIM you shall return.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to