Skip to content

Instantly share code, notes, and snippets.

@seedifferently
Last active June 14, 2017 14:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seedifferently/5867d16fcdd4d1feb1df1edcedd81207 to your computer and use it in GitHub Desktop.
Save seedifferently/5867d16fcdd4d1feb1df1edcedd81207 to your computer and use it in GitHub Desktop.
Python dict get method
>>> print(d.get('food'))
spam
>>> print(d.get('missing'))
None
>>> print(d.get('missing', 'I did not find a key by that name!'))
I did not find a key by that name!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment