【发布时间】:2016-06-07 20:12:17
【问题描述】:
我想合并两个 Python 字典加法,像这样:
a = {'result': {'sessionId': '111'}}
b = {'result': {'completelyOtherSessionId': '100'}}
##magic##
c = {'result': {'sessionId': '111', 'completelyOtherSessionId': '100'}}
【问题讨论】:
-
我看到键
sessionId和sessionsId略有不同。这是故意的吗? -
您是否查看过单页文档或有关 python 字典的文档?你用谷歌搜索过“python 合并字典”吗?
-
当然!但我能找到的只是 dict.update(otherdict) 函数......
标签: python python-3.x dictionary