Dictionary Syntax : Introduction « Dictionary « Python Tutorial






Dictionaries are written like this: 

phonebook = {'Alice': '2341', 'Beth': '9102', 'Cecil': '3258'} 

Dictionaries consist of pairs (called items) of keys and their corresponding values. 
Each key is separated from its value by a colon (:), the items are separated by commas, and the 
whole thing is enclosed in curly braces. 
An empty dictionary (without any items) is written with just two curly braces, like this: {}. 
Keys are unique within a dictionary (and any other kind of mapping), while values may not be.








8.1.Introduction
8.1.1.Dictionary Syntax
8.1.2.To loop over the keys of a dictionary, you can use a plain for statement
8.1.3.Simple one to one dictionary
8.1.4.One to many dictionary
8.1.5.Constructing a Dictionary
8.1.6.Many to many dictionary
8.1.7.Adding a Value to a Dictionary
8.1.8.Name and name would represent two completely distinct keys in the dictionary.
8.1.9.Add new key and value
8.1.10.Change value for existing key