#author:徐征 f= open("acount",mode="r",encoding="utf8") x = f.readlines() p=[] d={} for i in range(len(x)): p.append(x[i].strip().split("---")) d[p[i][0]] = p[i][1] f1=open("lock",mode="a+",encoding="utf8") lock_name=f1.readlines() flag=True count=0 while flag : user=input("username:") pwds=input("password:") if lock_name.count(user)==3: print("The user is locked!") continue while True: if list(d.keys()).count(user)!=0: if list(d.values()).count(pwds)!=0: print("success!") exit() else: print("Password is not correct!") lock_name.append(user) break else: print("The user does not exist!") break