2024-09-27 02:27:41 发布
网友
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和y或z在info2时,它只打印True?你知道吗
x
y
z
info2
True
按照我的理解,您希望info(info[0])中的第一个元素和info中的至少一个其他元素位于info2
info
info[0]
if info[0] in info2 and any(i in info2 for i in info[1:]): # do stuff
按照我的理解,您希望
info
(info[0]
)中的第一个元素和info
中的至少一个其他元素位于info2
相关问题 更多 >
编程相关推荐