Skip to content

Instantly share code, notes, and snippets.

@liluo
Created March 2, 2012 12:59
Show Gist options
  • Save liluo/1958259 to your computer and use it in GitHub Desktop.
Save liluo/1958259 to your computer and use it in GitHub Desktop.
from collections import Counter
r1 = {'a': {'q': 1, 'w': 2}, 'b': {'q': 3, 'w': 4}}
r2 = {'a': {'q': 5, 'w': 7}, 'b': {'q': 8, 'w': 2}}
r = dict(zip(r1.keys(), map(lambda r: dict(r[0] + r[1]), zip(map(lambda k: Counter(r1[k]), r1), map(lambda k: Counter(r2[k]), r2)))))
print r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment