两个字典的合并其实很简单,直接用dict的update即可,代码如下:

# /usr/bin/python3 
# -*- encoding: utf-8 -*-

import json

param1 = """
{"a":"1",
"b":"2"}
"""

param2 = """
{"b":"3",
"c":"4"}
"""

json1 = json.loads(param1)
json2 = json.loads(param2)

print("json1: ", json1)
print("json2: ", json2)

merge = dict(json1)
merge.update(json2)
print("merge: ", merge)

得到结果如下:

json1:  {'a': '1', 'b': '2'}
json2:  {'c': '4', 'b': '3'}
merge:  {'c': '4', 'a': '1', 'b': '3'}

最新文章

  1. 线程的创建pthread_create.c
  2. assert的用法
  3. http://jingyan.baidu.com/article/86112f13582848273797879b.html
  4. [C和指针]第三部分
  5. flex 弹性盒子模型一些案例.html
  6. 元素类型为 "package" 的内容必须匹配 "(result-types?,interceptors?,default-interceptor-ref?
  7. 修长城 (区间DP)
  8. Leetcode 26. Remove Duplicates from Sorted Array (easy)
  9. Oracle 高水位说明和释放表空间,加快表的查询速度
  10. python-校验密码小练习
  11. Mybatis面试题整理(超详细)
  12. 关于PRD、MRD、BRD文档
  13. python字符串的基本用法
  14. Minimum Size Subarray Sum LT209
  15. win7X64位安装mysql-5.7.16
  16. java Web的MVC最基础暂定分层包
  17. C#实现windows服务安装,服务名可配置时出问题(无法创建 ProjectInstaller 安装程序类型的实例)
  18. python3 + zabbix api 的使用
  19. Print Numbers by Recursion
  20. 实现SQL Server中的切割字符串SplitString函数

热门文章

  1. iOS进阶指南试读之UI篇
  2. iOS-通讯录(无界面)
  3. Android 编程下 Canvas and Drawables
  4. 监听的instance status blocked分析
  5. Python获取间隔时间段的时间戳数据
  6. js 去掉html标签
  7. vmware的硬件选项里有关于虚拟化引擎的选项(虚拟机支持硬件虚拟化)
  8. 基于ELK和Python搭建简单的监控告警系统
  9. java中ThreadExecutor使用注意
  10. Linux给tomcat指定jdk