PyThon3中判断一个内容属于另一个内容("a" 在 “abcd”中
代码:
str_data = "a132" list_data = ["a", 1, 3, "2"] tuple_data = ("a", 1, 3, "2") print("a" in str_data) print("a" in list_data) print("a" in tuple_data)
运行结果:
True
True
True
代码:
str_data = "a132" list_data = ["a", 1, 3, "2"] tuple_data = ("a", 1, 3, "2") print("a" in str_data) print("a" in list_data) print("a" in tuple_data)
运行结果:
True
True
True