Dictionary are not sequence, they are called mappings.
Initialization
When written as literals, dictionaries are coded in curly braces and consist of a series of “key: value” pairs.
D = {'S':32, 'M':45, 'L':50}
D['M']
45
D.keys()
dict_keys(['S', 'M', 'L'])
create from empty distionary
D = {}
D['S']=32
D['M']=45
for key in list(D.keys()):
print( key, '=>', D[key])
S => 32
M => 45
Operation
len(a) the number of items in a a[k] the item of a with key k a[k] = x set a[k] to x del a[k] remove a[k] from a a.items() a copy of a's list of (key, value) pairs a.keys() a copy of a's list of keys a.values() a copy of a's list of values a.has_key(k) 1 if a has a key k, else 0