我对我的python3持久密码更衣室有点麻烦。它按预期/期望存储和检索密码,但我决定插入一个“退出”检查,以便如果信息输入不正确,可以返回并重新输入。它似乎是跳过这个检查,没有容易识别的原因。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声明中明确指出没有选项,它也跳过了这些选项。多重'或'声明是否会将其抛出,或者有其他事情我应该注意?
'如果科尔== '是' 或' y'或'y'' - 与'if(corr =='yes')或'y'或'y'相同:'尝试'如果corr在('yes','y')中:' – tdelaney