I am trying to get a sorted dictionary. But the order of the items between mydict and orddict doesn't seem to change. from collections import OrderedDict mydict = {'a': 1, 'b': 2, 'c': 3, 'd': 4} orddict = OrderedDict(mydict) print(mydict, orddict) # print items in mydict: print('mydict') for k, v in mydict.items(): print(k, v) print('ordereddict') # print items in ordered dictionary for k, v in orddict.items(): print(k, v) # print the dictionary keys # for key in mydict.keys(): # print(key) # print the dictionary values # for value in mydict.values(): # print(value) Continue reading...