I want to do the same thins in this post reverse dictionary order . I didn't understand how to use OrderedDict. I tried this code with the dict() method used on the reversed list but It gave me the initial dictionary.
mydic = {'n1': 3, 'n2': 9}
ol = mydic.items()
ol.reverse()
print(ol)
dc = dict(ol)
print(dc)
as a result I get :
ol >> [('n2', 9), ('n1', 3)]
dc >> {'n1': 3, 'n2': 9}
Is there a way to rebuilt the dictionary after reversing the order ?
Thanks in advance