登录小程序
def pw(name,pass_word):
f = open("account", "r")
lines=f.readlines()
f.close()
for acc in lines:
u,d= acc.strip().split()
if u == name:
if d==pass_word:
#print "dengluchenggong"
return 1
else:
#print "mimacuowu"
return 0
# print "yonghubucunzai"
return -1
def islocked(name):
f=open('lock_account','r')
k=f.readlines()
f.close()
for line in k:
if name==line.strip().split()[0]:
return 1
else:
return -1
from Day1.login.lock_account import islocked
from Day1.login.account import pw
dict={}
while True:
user_name = raw_input("shuruyonghuming:")
pass_word = raw_input("shurumima:")
lock = islocked(user_name)
if lock:
print "yonghuyibeisuo"
else:
account = pw(user_name, pass_word)
if account == 1:
print "dengluchenggong"
elif account == 0:
print "mimacuowu"
if user_name in dict:
dict[user_name]+=1
else:
dict[user_name]=1
if dict[user_name]== 3:
f = open("lock_account", "a")
f.write("\n" + user_name)
f.flush()
f.close()
continue
else:
print "yonghubucunzai"
continue
posted on 2016-06-07 10:19 wangqianlfxh 阅读(163) 评论(0) 编辑 收藏 举报