标签:python
file = open(‘lock.txt‘).readlines()
name = input(‘username:‘).strip()
lock=[]
for i in file:
line = i.strip(‘\n‘)
lock.append(line)
if name in lock:
print(name,‘已经被锁定,请联系开户行.退出!‘)
else:
i = 1
while i <=3:
i = i + 1
print(‘........................‘)
username = name
print (username)
passwd = input(‘Passwd:‘).strip()
f = open(‘user.txt‘, ‘r‘)
login = False
if len(username) != 0 and len(passwd) != 0:
for line in f.readlines():
if username == line.split()[0] and passwd == line.split()[1] :
print("欢迎中国银行AMT系统")
login = True
break
else:
continue
if login is True:
break
else:
f = open(‘lock.txt‘, ‘a‘)
f.write(name)
f.write(‘\n‘)
f.close()
print(name,‘你的密码输入超过三,锁定帐号,退出‘)
本文出自 “强哥博客” 博客,请务必保留此出处http://listcto.blog.51cto.com/10175308/1640312
Python 编写登陆接口,输入用户名密码,认证成功后显示欢迎信息,输入错误三次锁定
标签:python
原文地址:http://listcto.blog.51cto.com/10175308/1640312