Google News
logo
Python - Interview Questions
How to display the contents of text file in reverse order?
1 . convert the given file into a list.
2 . reverse the list by using reversed()
Eg :  for line in reversed(list(open(“file-name”,”r”))): 
         print(line)
Advertisement