File: How to read the last line?

bowman bowman at montana.com
Wed May 5 23:01:21 EDT 1999


Usenet User <mail at to.me> wrote in message
news:8DBE693B8HolyMama at bbinews.netvigator.com...
> How can I jump to the last non-empty line in a openned file?
> Do I have to use readlines() and go to the last item in the
> list? What if it is a large text file?

Disclaimer: I'll be interested in seeing what someone who knows what they
are doing recommends,

I suspect if you don't want to eat the whole file, doing something like
seek(-256, 2), then a read(256)  and searching for the last line yourself
might work.








More information about the Python-list mailing list