The Python
>>> x = {"USA":3,"China":13,"Brazil":1} >>> x
{'Brazil':1,'China':13,'USA':3}
>>> x = {2:3,"China":13,"Brazil":[1,2,3]} >>> x
{2: 3, 'Brazil': [1,2,3],'China': 13}Add items to dictionary:
>>> x[12] = "aa" >>> x
{2: 3, 12: 'aa', 'Brazil': [1,2,3],'China': 13}Delete items of dictionary:
>>> del x[2] >>> x
{12: 'aa', 'Brazil': [1,2,3],'China': 13}
>>> x.clear()#remove all entries in x >>> del xdelete x
Update dictionary item value:
>>> x = {12: 'aa', 'Brazil': [1,2,3],'China': 13} >>> x[12] = "bb"#update x[12] value >>> x
{12: 'bb', 'Brazil': [1,2,3], 'China': 13}