Last active
June 15, 2017 13:13
-
-
Save seedifferently/1bb21965b75538c25f755ed28ec3472a to your computer and use it in GitHub Desktop.
Python dict examples
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
>>> # create an empty dict | |
>>> d = {} | |
>>> # set a key/value pair | |
>>> d['food'] = 'spam' | |
>>> # retrieve a value for the key | |
>>> d['food'] | |
'spam' | |
>>> # remove a key/value pair | |
>>> del d['food'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment