Read file from bottom

Julia Bell julia.bell at jpl.nasa.gov
Mon May 13 15:26:54 EDT 2002


I'm currently using
    line = input_handle.readline()
to read individual lines from an input file; however, I'm only generally
interested in the last few lines of the line (not the preceeding several
thousand lines).

Is there an efficient (and relatively easy - I'm new to Python) way of
reading the file from the last line backward instead of the first line
forward?

(I do not want to read the entire file using readlines because it could
overwhelm the memory.)





More information about the Python-list mailing list