Reading a text file backwards

Graham Fawcett graham.fawcett at
Fri Oct 1 02:41:14 CEST 2004

It's just shifting the burden perhaps, but if you're on a Unix system
you should be able to use tac(1) to reverse your file a bit faster:

import os
for line in os.popen('tac myfile.txt'):
#do something with the line

More information about the Python-list mailing list