我最近开始使用Python。我知道这可能是个愚蠢的问题,因为我觉得这是一个非常基本的问题。在
我需要将first list
与second list
进行比较,如果first list
值存在于second list
中,那么我想返回true。在
children1 = ['test1']
children2 = ['test2', 'test5', 'test1']
if check_list(children1):
print "hello world"
def check_list(children):
# some code here and return true if it gets matched.
# compare children here with children2, if children value is there in children2
# then return true otherwise false
在上面的例子中,我想看看children1
列表值是否在children2
列表中,然后返回true。在
您可以使用
all
退货
^{pr2}$set
s有一个^{<=
:相关问题 更多 >
编程相关推荐