Skip to content

Instantly share code, notes, and snippets.

@avalanchy
Created July 14, 2014 13:22
Show Gist options
  • Select an option

  • Save avalanchy/080a1f1410b2b2dbf13a to your computer and use it in GitHub Desktop.

Select an option

Save avalanchy/080a1f1410b2b2dbf13a to your computer and use it in GitHub Desktop.
compare two dicts by showing diff #python
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