我有一个列表的列表,并希望检查它是否已经包含具有特定项目的列表。如何测试一个列表是否包含另一个包含Python中特定项目的列表?
一切都应该清楚从这个例子:
list = [[1,2],[3,4],[4,5],[6,7]]
for test in [[1,1],[1,2],[2,1]]:
if test in list:
print True
else:
print False
#Expected:
# False
# True
# True
#Reality:
# False
# True
# False
是否存在,无论列表的项目比较它们是如何排序的功能?
[使用Python在另一个列表中搜索列表的值]可能的重复(http://stackoverflow.com/questions/1695452/searching-values-of-a-list-in-another-list-using-python ) – 2010-11-05 18:35:37
在...中进行测试:在列表中打印排序(测试) – 2010-11-05 20:37:14