Python homework

 1 #coding:utf8
 2 user_list =[]
 3 for i in range(1,302):
 4     tmp = "{'user':'alex-%s,'email':'alex%[email protected]','pwd':'pwd%s'}" %(i,i,i)
 5     user_list.append(tmp)
 6 while True:
 7     user_choice = input("请输入页码:").strip()
 8     if user_choice.isdecimal():
 9         user_choice = int(user_choice)
10         if user_choice >0 anduser_choice <=len(user_list)/10+1 :
 11              min = user_choice * 10 -10
 12              max = user_choice *10
 13              for item in user_list[min:max]:
 14                  print (item)
 15          else :
 16              print ( " You The entered page number does not exist, the maximum can only be %d pages. " %(len(user_list)/10 + 1 ))
 17      else :
 18          print ( " You entered not a number page.. " )

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325479506&siteId=291194637