在 python 中搜索三个字符中的两个

Searching two of the three characters in python

 info=('x','y','z')
 info2=('x','Bob','y')
 match=False
 if any(all x in info for x in info2):
    match=True
    print("True")
 else:
     print("False")

有没有一种方法可以让它工作,以便它只在 x 并且 yz 位于 [=16] 时打印 True =]?

按照我的阅读方式,您希望 info 中的第一个元素 (info[0]),并且 info 中的至少一个其他元素位于 info2

 if info[0] in info2 and any(i in info2 for i in info[1:]):
     # do stuff