我有一個問題,如何計算相同鍵的總字典?我有一個字典:計算總值字典
{'learning': {'DOC1': 0.14054651081081646,
'DOC2': 0,
'DOC3': 0.4684883693693881},
'life': {'DOC1': 0.14054651081081646,
'DOC2': 0.20078072972973776,
'DOC3': 0}
}
,我希望的結果爲:
{'learning life': {
'DOC1': DOC1 in learning + DOC1 in life,
'DOC2': DOC2 in learning + DOC2 in life,
'DOC3': DOC3 in learning + DOC3 in life,}}
非常感謝您
的[有兩種類型的字典(用於顯示鍵增加值組合任何Python的方式可能的複製在兩個)?](http://stackoverflow.com/questions/11011756/is-there-any-pythonic-way-to-combine-two-dicts-adding-values-for-keys-that-appe) – Querenker