#!/usr/bin/env python # -*- coding:utf-8 -*- # Author:Huanglinsheng #输入用户名密码,认证成功后显示欢迎信息,输错三次后锁定 file = open('lock.txt').readlines() name = input('username:').strip() lock=[] for i in file: line = i.strip(' ') 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(' ') f.close() print(name,'你的密码输入超过三,锁定帐号,退出')