File: How to read the last line?

Darrell news at dorb.com
Thu May 6 01:07:28 EDT 1999


A small variation on Bowman's idea. But a problem is what is the max length
of a line ? Working in SGML a line can be huge.

fp=open('xxx.sgm')
fp.seek(-1024,2)
l=fp.readlines()
print l[-1]

--Darrell






More information about the Python-list mailing list