Created
July 14, 2014 13:22
-
-
Save avalanchy/080a1f1410b2b2dbf13a to your computer and use it in GitHub Desktop.
compare two dicts by showing diff #python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from difflib import ndiff | |
| from pprint import pformat | |
| def dicts_diff(d1, d2): | |
| return '\n'.join(ndiff(*(pformat(d).splitlines() for d in (d1, d2)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment