Which lib can diff two dict tree?

alex23 wuwei23 at gmail.com
Thu Jul 19 20:17:43 EDT 2012


On Jul 19, 7:51 pm, esbat... at gmail.com wrote:
> Q1:
> which lib can diff two dict tree?
> Q2
> How can I diff two json file?How can I get struct_diff and value_diff?
> Q3
> How can I diff two xml file? How can I get struct_diff and value_diff?

Rather than trying to come up with a method for finding the diffs of
three different data structures, it might be easier to transform all
the structures into the same form and then just use one mechanism for
diffs.

There's a 3rd-party python library for producing diffs of XML
documents:
http://www.logilab.org/projects/xmldiff

Python dicts can be converted to XML using one of the suggestions
here:
http://stackoverflow.com/questions/1019895/serialize-python-dictionary-to-xml

JSON can be transformed into dicts by using the standard library's
json module.



More information about the Python-list mailing list