flag = True
while flag:
user = input('please input your username:')
locked = open('locked', 'r+', encoding='utf8')
for line1 in locked:
if user.strip() != line1:
f = open('账户信息', encoding='utf8')
for line in f:
list=line.split('---')
username=list[0]
passwd=list[1]
if username.strip() == user.strip():
count = 0
while count < 3:
psd = input('please input your password:')
if passwd.strip() == psd.strip():
print('welcome !')
flag = False
break
else:
print('passwd error')
count += 1
if count == 3:
print('输错3次,用户已锁定')
locked.write(user.strip())
locked.close()
flag = False
break
else:
print('用户已锁定')