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

2024-09-27 02:27:41 发布

您现在位置: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")

我有没有办法让它工作,当xyzinfo2时,它只打印True?你知道吗


Tags: ininfofalsetrueforifmatchany

热门问题