iNTERFACEWARE Products Manual > Learning Center > Learning Python > Dictionaries > Creating and Accessing Dictionaries |
|
Looking for Iguana v.5 or v.6? Learn More or see the Help Center.
Here is an example of a simple dictionary definition:
In this dictionary, the keys are the names of people, and the values are their patient IDs. To access the value of an element of a dictionary, supply its key in brackets []:
To add a new element to a dictionary, assign a value to a new key:
To update an element of a dictionary, assign a new value to its key:
To delete an element, use del():
To check whether a key has an element defined in a dictionary, use has_key():
|