我正在用Python做一個登錄安全程序,並且這部分總是陷入無限循環。如果你被鎖定,它會一直說「你被鎖定了10秒」,並且它無限循環。我該如何解決?如何修復Python中的無限循環?
tries=0
while finalusername!=username or finalpassword!=password:
tries=tries+1
print "That incorrect. Try again."
print "You have", 5-tries, "tries left."
finalusername= raw_input ("Username:")
finalpassword= raw_input ("Password:")
while tries>=4:
print "You have been locked out for 10 seconds. Please call the administrator if this keeps happening."
sleep (10.0)
system ('CLS')
finalusername!=username
finalpassword!=password
你壓痕顯然是錯誤的。這會產生語法錯誤。 – jpmc26