python之分页显示内容

要求:分页显示101条数据,每页仅显示10条数据

user_data=[]

for i in range(1,102):

        dic={'username':'Lucy'+str(i),'email':'lucy'+str(i)+'@163.com','passwd':'cmd'+str(i)}

        user_data.append(dic)

# 每页仅显示10条数据

# 第一页:从0-10      1页

# 第二页:从10-20    2页

# 第三页:从20-30    3页

# ............................................

扫描二维码关注公众号,回复: 8780541 查看本文章

while True:

        s=input("请输入页码:")

        s=int(s)

        start=(s-1)*10

        end=s*10

        for item in user_data[start:end]:

                 print(item,type(item))

        

猜你喜欢

转载自www.cnblogs.com/cxydnxs/p/12229131.html