Folks, 相對n00b python,試圖找出兩個詞典列表的差異。Python:如何比較兩個詞典列表
如果這些只是常規列表,我可以創建集合然後執行' - '/ intersect操作。
然而,設定操作不會對字典的名單工作:
>>> l = []
>>> pool1 = {}
>>> l.append(pool1)
>>> s = set(l)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unhashable type: 'dict'
'OrderedDict'是*不*可哈希類型。 – 2011-05-04 15:39:19