I\'m writing a log file viewer for a web application and for that I want to paginate through the lines of the log file. The items in the file are line based with the newest
The simplest way is to use deque:
deque
from collections import deque def tail(filename, n=10): with open(filename) as f: return deque(f, n)