#!/usr/bin/python2

import sys

filename = raw_input(‘Enter a filename: ‘)

try:
fobj = file(filename,’r’)
except IOError, e:
print e
else:
start = 0
i = 1
end = pagesize = 5
lines = fobj.readlines()
while True:
if i >= len(lines):
print ‘End of file. exit…’
sys.exit()
for line in lines[start:end]:
print ‘%s:\t%s’ % (i,line),
i += 1
start = end
i = end + 1
end += pagesize
r = raw_input(‘Press any key to continue…’)
if r == ‘x’:
sys.exit()