Read file from bottom

Kragen Sitaker kragen at pobox.com
Fri May 17 02:51:16 EDT 2002


Julia Bell <julia.bell at jpl.nasa.gov> writes:
> My initial reaction is that I don't know I exactly how many lines frm the
> bottom I want.

import os
backwardsfile = os.popen("tac %s" % filename)
while 1:
    line = backwardsfile.readline()
    if line == '': break
    # do whatever




More information about the Python-list mailing list