如何比较两个OrderedDict dictionareis?如何比较两个OrderedDict词典?
我的结构如下:
dict_a = OrderedDict([(1,4), (2,5), (3,3), (4,5), (5,4), (6,4), (7,4), (8,3), (9,4)])
dict_b = OrderedDict([(1,4), (2,2), (3,1), (4,4), (5,6), (6,7), (7,4), (8,2), (9,5)])
for values in score_dict.items():
if values == course_dict.values():
print 'match!'
else:
print 'No match!'
它通过迭代和两个列表是有序的,所以应该匹配1和7? 在此先感谢!
感谢您的所有答案!得到它与Simeon的解决方案一起工作。 – Epalissad 2012-08-14 22:04:53