To display the contents of a file in reverse, the following code can be used:
for line in reversed(list(open(filename.txt))):
print(line.rstrip())