代码如下:
1 # 编辑者:闫龙 2 if __name__ == '__main__': 3 import UserLoginFuncation 4 5 LoclCount=[]; 6 while True: 7 UserName = input("用户名:>>") 8 if(UserLoginFuncation.CheckUserLock(UserName)): 9 print("用户",UserName,"已被锁定") 10 continue 11 PassWd = input("密 码:>>") 12 if(UserLoginFuncation.UserInfo(UserName,PassWd)): 13 print("欢迎",UserName,"登陆") 14 break 15 else: 16 LoclCount.append(UserName); 17 print("用户名或密码错误,您还有",3-LoclCount.count(UserName),"次尝试机会") 18 if(LoclCount.count(UserName) == 3): 19 UserLoginFuncation.LockUser(UserName) 20 print("对不起,尝试次数过多",UserName,"用户已被锁定")