mm = {"xzh":"xzh", "qwe":"qwe"}
with open('jilu', 'r', encoding="utf-8") as f:
lockuser = []
for user in f.readlines():
lockuser.append(user.strip())
#print(lockuser)
username = input("Please input username: ")
if username not in lockuser:
err = 0
true_pass = mm.get(username)
for i in range(3):
password = input("Please input your password: ")
if password == true_pass:
print("login Successful!")
else:
print("This password is wrong!")
err += 1
if err == 3:
with open('jilu' , 'a', encoding="utf-8") as f2:
f2.write('\r'+username)
else:
print("Username is locked")
08-12
137
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
07-20
180
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
07-17
573
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
07-17
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交