还有一些小bug
基本有
输入用户名密码
认证成功后显示欢迎信息
输出三次后锁定
# -*- coding:utf-8 -*-
account_file=('C:\Users\guigu\Desktop\user.txt')
lock_file=('C:\Users\guigu\Desktop\lock.txt')
f = file(account_file)
account_list = f.readlines()
f.close()
while True:
f = file(lock_file)
lock_list=[]
for i in f.readlines():
line = i.strip('\n')
lock_list.append(line)
f.close()
loginSuccess = False
username=raw_input("username:").strip()
if username in lock_list:
print "sorry,you are already in the block list,get the fuck out!"
break
for line in account_list:
line=line.split()
if line[0] == username:
for i in range(3):
password = raw_input('password:').strip()
if password == line[1]:
print "welcome %s login my system" % username
loginSuccess = True
break