Skip to content

Instantly share code, notes, and snippets.

@Gwith
Created August 9, 2016 22:42
Show Gist options
  • Select an option

  • Save Gwith/7373764d35b6a75f51ea30c8b2c3f6a1 to your computer and use it in GitHub Desktop.

Select an option

Save Gwith/7373764d35b6a75f51ea30c8b2c3f6a1 to your computer and use it in GitHub Desktop.
test1 = { 'cat' : 1, 'dog' : 1, 'bird' : 1}
test2 = { 'cat' : 3, 'dog' : 2, 'cow' : 2 }
for key, value in test2.items():
test1[key] = test2.get(key, 0) + 1
print(test1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment