Python作业

#coding:utf8
 user_list =[]
 for i in range(1,302):
     tmp = "{'user':'alex-%s,'email':'alex%[email protected]','pwd':'pwd%s'}" %(i,i,i)
     user_list.append(tmp)
 while True:
     user_choice = input("请输入页码:").strip()
     if user_choice.isdecimal():
         user_choice = int(user_choice)
         if user_choice >0 and user_choice <=len(user_list)/10+1:
             min = user_choice * 10 -10
             max = user_choice *10
             for item in user_list[min:max]:
                 print(item)
         else:
             print("你输入的页码不存在,最大只能为%d页。"%(len(user_list)/10 + 1))
     else:
         print("你输入的不是数字页面。。")

相关推荐