1 div={2 'list1':{'password':'123456'},3 'list2':{'password':'123456'},4 'list3':{'password':'123456'},5 }6 f = open('black_user','r')7 lock_file =f.readlines()8 f.close()9 count=010 count1=011 whileTrue:12 name_input=input("please input name:")13 if count == 3:14 print("用户名输入次数到达限制")15 break
16 if not name_input indiv:17 print("用户名错误")18 count +=1
19 if name_input inlock_file:20 print("户名已锁定,暂停使用!")21 exit()22
23 if name_input indiv:24 count -=2
25 password_input=str(input("please input password:"))26 if password_input == div[name_input]['password']:27 print ("密码成功")28 break
29 else:30 print("密码错误")31 count1 +=1
32 if count1 == 2:33 print("您输入的密码错误次数已达3次,将锁定您的账户!")34 f = open('black_user', 'w')35 f.write('%s'%name_input)36 f.close()37 break