登录小程序

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

转载于:https://www.cnblogs.com/wangqianlfxh/p/5566094.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值