标签:流程 == 判断 lines bre adl named [] 简单
from numpy import*
classcount={}
lock_name=[]
passDate=[]
nameDate=[]
fr1=open(‘User.txt‘)
for line in fr1.readlines():
lineArr=line.strip().split()
nameDate.append(lineArr[0])
passDate.append(lineArr[1])
nameDate=list(nameDate)
passDate=list(passDate)
m=shape(nameDate)[0]
while 1:
fr2=open(‘lock_name.txt‘)
for line in fr2.readlines():
lock_name.append(line)
n=shape(lock_name)[0]
Username=input(‘Username:‘)
PassWord=input(‘Password:‘)
for i in range(n):
if Username==lock_name[i]:
print(‘this count was locked‘)
break
for j in range(m):
if Username==nameDate[j] and PassWord==passDate[j]:
print(‘welcome enter‘)
break
else:
classcount[Username]=classcount.get(Username,0)+1
if classcount[Username]>2:
print(‘this count was locked‘)
fr2 = open(‘lock_name.txt‘,‘w‘)
fr2.write(Username)
fr2.close
break
else:
print(‘please input again‘)
break
###流程图
---------先输入用户名与密码
--------与已经锁定的账号做比较
------------------------Y 则输出账号已经锁定
------------------------N 在于文件中的 用户名与密码做比较
--------------------------------Y 输出欢迎进入
-------------------------------N 判断该账号的输入次数是否大于3次
---------------------------------------------Y 锁定该账号并将该账号写入锁定文件
---------------------------------------------N 请用户重新输入账号和密码
标签:流程 == 判断 lines bre adl named [] 简单
原文地址:http://www.cnblogs.com/zhou1993/p/7649982.html