首页 > 代码库 > 三次锁定修改

三次锁定修改

a = open("acount",mode="r",encoding="utf8")
b = a.readlines()
c = []
d = {}
for i in range(len(b)):
    c.append(b[i].strip().split("---"))
    d[c[i][0]] = c[i][1]

a1=open("lock", mode="a+", encoding="utf8")
lock_name = a1.readlines()

flag = True
count = 0
while flag:
    user = input("username:")
    pwds = input("password:")
    if lock_name.count(user)==3:
        print("locked!")
        continue
    while True:
        if list(d.keys()).count(user)!= 0:
            if list(d.values()).count(pwds)!= 0:
                print("success!")
                exit()
            else:
                print("密码错误!")
                lock_name.append(user)
                break
        else:
            print("此用户没有")
            break

 

三次锁定修改