How to read a file in reverse order using python? I want to read a file from last line to first line.
for line in reversed(open("file").readlines()): print line.rstrip()
If you are on linux, you can use tac command.
tac
$ tac file
2 recipes you can find in ActiveState here and here