它处理的不仅仅是递归字典差异:
安装
从PyPi安装:pip install deepdiff
如果您是Python3,还需要安装:
^{2}$
示例用法>>> from deepdiff import DeepDiff
>>> from pprint import pprint
>>> from __future__ import print_function
同一对象返回空>>> t1 = {1:1, 2:2, 3:3}
>>> t2 = t1
>>> ddiff = DeepDiff(t1, t2)
>>> print (ddiff.changes)
{}
项目类型已更改>>> t1 = {1:1, 2:2, 3:3}
>>> t2 = {1:1, 2:"2", 3:3}
>>> ddiff = DeepDiff(t1, t2)
>>> print (ddiff.changes)
{'type_changes': ["root[2]: 2= vs. 2="]}
项的值已更改>>> t1 = {1:1, 2:2, 3:3}
>>> t2 = {1:1, 2:4, 3:3}
>>> ddiff = DeepDiff(t1, t2)
>>> print (ddiff.cha