我试图在python3中进行一个category select(通过文本接口),我想知道如果多个字符串不正确,如何进行比较,然后按照“这不是一个有效的选择”这样的行打印一些内容
input("what is your category choice?")
if categoryChoice != "category1", "category 2", "category 3":
print("not a valid choice")
我不明白让它检查category1、category2、category3等是否为true/false的语法
Use ^{} for containment tests.
http://ideone.com/e6n0Rr
顺便说一下,如果您使用的是python2,那么您应该使用}。在
raw_input
而不是{相关问题 更多 >
编程相关推荐