【发布时间】:2013-12-06 03:21:35
【问题描述】:
我不太确定我在这里做错了什么。我将 tTitle 输入为 100,将 tJson 输入为 mm,但是当我应该得到 5 时它会一直返回 6。正如您在“all([])”中看到的那样,我尝试了其他方法,但似乎没有任何效果。
if "any" or "Any" or "ANY" in tTitle:
tCAT = 0
if "100" in tTitle:
tCAT = 1
if "100" in tTitle and tJson == "tloz2":
tCAT = 3
if "45" in tTitle and tJson == "ss":
tCAT = 4
if all(["100" in tTitle, tJson == "mm"]):
tCAT = 5
if all(["any" or "Any" or "ANY" in tTitle, tJson == "mm"]):
tCAT = 6
else:
tCAT = 0
【问题讨论】:
-
又一个新程序员被布尔逻辑绊倒了。
-
我觉得我应该把它变成一个字符串
-
if "any" in tTitle.lower():也许?
标签: python if-statement int