Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

OrderedDict

# A Python program to demonstrate working of OrderedDict
from collections import OrderedDict
 
print("This is a Dict:
")
d = {}
d['a'] = 1
d['b'] = 2
d['c'] = 3
d['d'] = 4
 
for key, value in d.items():
    print(key, value)
 
print("
This is an Ordered Dict:
")
od = OrderedDict()
od['a'] = 1
od['b'] = 2
od['c'] = 3
od['d'] = 4
 
for key, value in od.items():
    print(key, value)
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #OrderedDict
ADD COMMENT
Topic
Name
5+8 =