#Author jack
# _*_ coding: utf-8 _*_
#date 2019-08-14
'''
作业一:编写登录接口
输入用户名密码
认证成功后显示欢迎信息
输错三次后锁定
'''
#判断用户账号密码
def check_pass(username, password):
with open('userfile.txt', 'r+') as f:
content = f.readlines()
for i in content:
if i.split(',')[0] == username and i.split(',')[1].strip('\n') == password:
return True
break
else:
return False
#判断用户名是否锁定:
def isLock(username):
with open('locklist.txt', 'r') as f:
cont = f.read()
if username in cont:
return False
else:
return True
#写锁定用户名到locklist,如果用户输错三次,就调用此函数,讲锁定的用户名写入此文件
def writeErrlist(username):
with open('