day11.3分页操作divmod

# 分页显示 divmod(被除数,除数)
INFO_LIST = []
for i in range(836):
template = "第%s天,笨笨先僧 always be there with you" % i,
# print(template)
INFO_LIST.append(template) per_page_count = 10
total_page, rem = divmod(836, per_page_count)
if rem > 0:
total_page = total_page + 1 # 计算出总页数
# 输入页数 显示
while True:
val = input("请输入页数:") val = int(val)
if val>total_page_count or val<1
start = (val - 1) * per_page_count
end = val * per_page_count
for ele in range(start, end):
print(INFO_LIST[ele])
上一篇:RibbonControl 工具栏上的一些基本操作


下一篇:Chrome浏览器清除缓存