我的 python3 持久密码储物柜有点麻烦。它按预期/期望存储和检索密码,但我决定插入“退出”检查,以便如果信息输入不正确,您可以返回并重新输入。它似乎因为没有容易识别的原因而跳过了这个检查。
elif choice == 2:
conti = False
while conti != True:
print('Enter an account and password to store')
acc = input('Account: ')
apass = input('Password: ')
print('Account: ' + acc + '\n' + 'Password: ' + apass)
print('Correct?')
corr = input(': ')
corr.lower()
if corr == 'yes' or 'ye' or 'y':
print('Making Changes persistent')
# Shelve Stuff
conti = True
break
else:
print('Please make appropriate changes.')
continue
当我运行此代码时,无论 corr 变量是什么,它都会使更改持久化。这不是我想要的。我尝试在 elif 语句中明确声明 no 选项,它也跳过了这些选项。是多个“或”语句将其扔掉还是我应该注意的其他事情?