-
练习 分页展示
divmod(total_number,perPage_num)内置函数# 分页显示 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 or val>=1 start = (val - 1) * per_page_count end = val * per_page_count for index in range(start, end): print(INFO_LIST[index])
分页展示小思想 divmod内置函数
最新推荐文章于 2025-06-15 04:32:59 发布