python登陆接口


user = "jack"
password = 123
count = 0

def write_lock_list(name): #将输入的用户名写入文件当中
file = open('lock_list','w')
file.writelines(name)
file.close()

def read_lock_list(name): #读取列表中用户
file =open('lock_list','r')
file_user=file.read()
return file_user

while count<3:
username=input("name:")
userpassword=input("password:")
lock_user=read_lock_list(username)
if lock_user==username: #输入用户与锁定列表中的用户做对比
print("{0} has already been locaked! ".format(lock_user))
break
elif username == user and userpassword==password:
print("welcom to my blog!")
break
count +=1
else:
if count==3: #如果计数为3的话证明该用户被锁定,因此将该用户加入到锁定列表中
write_lock_list(username)
print("{0} has already been locaked! ".format(username))

转载于:https://www.cnblogs.com/mahaigang/p/9851431.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值