How to find the beginning of last line of a big text file ?

Barak, Ron Ron.Barak at lsi.com
Thu Jan 1 11:19:03 EST 2009


Hi,

I have a very big text file: I need to find the place where the last line begins (namely, the offset of the one-before-the-last '\n' + 1).

Could you suggest a way to do that without getting all the file into memory (as I said, it's a big file), or heaving to readline() all lines (ditto) ?

Thanks,
Ron.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090101/fcbdc0ce/attachment.html>


More information about the Python-list mailing list