Before Python 3.7, OrderedDict was needed to maintain insertion order of dictionary keys.
Source Code
from collections import OrderedDict
od = OrderedDict()
od["c"] = 3
od["a"] = 1
od["b"] = 2
for key in od:
print(key, od[key])
Before Python 3.7, OrderedDict was needed to maintain insertion order of dictionary keys.
from collections import OrderedDict
od = OrderedDict()
od["c"] = 3
od["a"] = 1
od["b"] = 2
for key in od:
print(key, od[key])