Python Dictionaries
Posted:
Tuesday, November 8th, 2011Last modified:
Sunday, March 29th, 2015Create an empty dictionary.
D = {}
Create a populated dictionary.
D = {'key':'value'}
>>> print D {'key': 'value'}
Add a new item to the dictionary.
D['new key'] = 'new value'
>>> print D {'new key': 'new value', 'key': 'value'}
Update a value
D['new key'] = 'updated value'
>>> print D {'new key': 'updated value', 'key': 'value'}
Available Wiki Topics
The operator of this site makes no claims, promises, or guarantees of the accuracy, completeness, originality, uniqueness, or even general adequacy of the contents herein and expressly disclaims liability for errors and omissions in the contents of this website.