0
同時使腳本我有一些奇怪的beheiviour形成python3解釋 的錯誤僅僅是這個 我輸入正確的用戶名和密碼我與一個沒有條件的無限循環授予Python3密碼給了我一個循環
def LoginAdmin():
# 3 chances seulement ...
LoginTrial = 3
position=0
AdminOK=0
AdminCheck=[]
PassCheck = open('Data_LoginAdmin', 'r')
#lecture des lignes et mise en données les informations mdp et login
for ligne in PassCheck:
print(ligne, end='')
words = ligne.split(":")
AdminCheck.append(words)
print(AdminCheck)
PassCheck.close()
LoginAdminAcces = True
while (((LoginTrial != 0) or (AdminOK == True))):
UserAdminName=input("Identification : ")
if not UserAdminName.isalpha:
LoginTrial = LoginTrial - 1
print("Autentification Échouer essai restant : ", LoginTrial)
elif UserAdminName != AdminCheck[0][0]:
LoginTrial = LoginTrial - 1
print("Autentification Échouer essai restant : ", LoginTrial)
elif UserAdminName == AdminCheck[0][0]:
while (((LoginTrial != 0) or (AdminOK == True))):
UserAdminPass=input("Mot de pass : ")
if not UserAdminName.isalpha:
LoginTrial = LoginTrial - 1
print("Autentification Échouer essai restant : ", LoginTrial)
elif UserAdminPass != AdminCheck[0][1]:
LoginTrial = LoginTrial - 1
print("Autentification Échouer essai restant : ", LoginTrial)
elif UserAdminPass == AdminCheck[0][1]:
LoginAdminAcces = True
AdminOK=True
print(AdminOK)
print("Accès apprové ...")
if LoginTrial == 0:
print("Accès Refusé !!!")
LoginAdminAcces = False
return (LoginAdminAcces)
這是文件Data_LoginAdmin
Admin:AdminPass
,如果有人看到它爲什麼會救我的命......那種......
此外,由於AdminOK是一個布爾值,所以您可以只說'不是AdminOK'。 – Alec
工作,我認爲我需要咖啡因或一些睡眠... – GothSparkImvu
編輯nop仍然得到循環...它實際上忽略真假部分... – GothSparkImvu