"""
输出文件的内容,按照五个一页的元素进行分类(divmod算商和余数)
"""
with open('TG.txt',encoding='utf-8') as f:
l=f.readlines()
jk=[]
for i in l:
jk.append(str(l.index(i)+1)+'.'+i)
# print(len(jk))
div,mod=divmod(len(jk),5)
# print(div,mod)
m=0
while m<3:
page_num = input("请输入页码: ")
if int(page_num)>0 and int(page_num)<div+1:
for n in range(5):
print(jk[((int(page_num)-1)*5+n)].strip())
elif int(page_num)==div+1:
for n in range(mod):
print(jk[div*5+n].strip())
else:
m += 1
print("请重新输入页码%s次,错误3次就会终止程序" %m)