设计一个登陆接口,连续三次输入不正确,强制退出,不让继续尝试,并记录下用户名,下次禁止登陆。
_username = "test"
_password = "test"
count = 1
while count <= 3:
username = input("input your username: ")
password = input("input your password: ")
f1 = open('D:\py\day1\denglu.txt', 'r')
if username in f1:
print("you hava try more than three times")
break
else:
if username == _username and password == _password:
print("you login sucessful")
break
else:
print("please input the right username ")
count +=1
else:
f = open('D:\py\day1\denglu.txt', 'w+')
f.write(username)
f.close()
浙公网安备 33010602011771号