Last active
June 14, 2017 14:53
-
-
Save seedifferently/5867d16fcdd4d1feb1df1edcedd81207 to your computer and use it in GitHub Desktop.
Python dict get method
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
>>> 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