【python】A in B 时的注意事项 【python】A in B 时的注意事项 【python】A in B 时的注意事项 判断字符串是否在列表中, A完全相等于B中的某个值 : a = "value" b = ["value1", "value2", "value3"] if any(a == item for item in b): print("字符串 a 等于列表 b 中的某个元素") else: print("字符串 a 不等于列表 b 中的任何元素")