我有一个列表列表(listA)和另一个单独的列表(listB)。我试图检查listB是否与listA中的任何列表匹配,这是基于我在testing12函数中所做的类型和位置。我的问题是我该怎么做才能让if语句给我一个全面的评价,即正确或错误。如果有一个或多个匹配项,则为True;如果根本没有匹配项,则为False
listA = [[3,"alpha"], [7, 8], ["hat", "bat"]]
listB = [5,5]
def testing12(x,y):
result = map(type, x) == map(type, y)
return result
for n in lists:
if testing12(list,n) == True:
print "True"
else:
print "False"
要使用^{} 或^{} 内置程序:
或:
相关问题 更多 >
编程相关推荐