from collections import OrderedDict
od=OrderedDict()
od['a']=1
od['c']=2
od['b']=3
print(od)
OrderedDict([('a', 1), ('c', 2), ('b', 3)])
list(od.keys())
['a', 'c', 'b']
keys=['apple','banana','orange']
values=[4,5,6]
od.update(zip(keys,values))
print(od)
OrderedDict([('a', 1), ('c', 2), ('b', 3), ('apple', 4), ('banana', 5), ('orange', 6)])
od.pop('a')
1
print(od)
OrderedDict([('c', 2), ('b', 3), ('apple', 4), ('banana', 5), ('orange', 6)])
od.move_to_end('b')
print(od)
OrderedDict([('c', 2), ('apple', 4), ('banana', 5), ('orange', 6), ('b', 3)])
from collections import defaultdict
dic0=defaultdict(lambda:'N/A')
dic0['key1']=1
dic0['key1']
1
dic0['key2']
'N/A'
list1=['a','b','d','a','a','d','c','e','d',