Python - To read text file line by line in reverse

Description

To read text file line by line in reverse

Demo

for line in reversed(open('main.py').readlines()):
    print(line.rstrip())

Result

Related Example