【疑问】用python写登录验证遇到的问题

最近开始断断续续学习python,今天加入博客园,作为新人,和各位老师们讨教了,以后多多照顾!为了大家能看清楚所以就截图了,文末尾附源码,
说不定会有那位老师给我指教一番。

##############################################################

 
 
##############################################################

输出结果总是我写的所有提示语,不知道为何。

以下为输出结果:






附源码:

# Author:Zhang Peng

_username="zhangpeng"
_password="123"

count=0

while count<3:
username = input("Username:")
password = input("Password:")

with open('e:\py\course\锁定名单.txt') as f:
contents = f.read()
for username in contents:
if username == contents:
print("You have been locked! Please contact the administrator")
break
else:
continue

while 1>0:

if username == _username and password == _password:
print("Welcome to back!")
break

if username != _username or password != _password:
print("Invalid username or password!")
count +=1

if count == 1:
print("You have only three chances!")

if count == 2:
print("You only have one more chance!!!")
else:





转载于:https://www.cnblogs.com/zpzcy/p/7645474.html

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值