【疑問】用python寫登錄驗證遇到的問題
阿新 • • 發佈:2017-10-10
password () http eas ini contact blog pre 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:
【疑問】用python寫登錄驗證遇到的問題