When i use the items() function of dict in python2.7, i found the order of result has been changed. I want to know how it is sorted in dict.items().
a = {'Person':1, 'Education':1}
b = {':Person':1,':Education':1}
c = {'Education':1, 'Person':1, }
d = {':Education':1,':Person':1,}
print(a.items())
print(b.items())
print(c.items())
print(d.items())
output:
[('Person', 1), ('Education', 1)]
[(':Education', 1), (':Person', 1)]
[('Person', 1), ('Education', 1)]
[(':Person', 1), (':Education', 1)]
background: I will reimplement the code with python3.7. So i must keep the order of output the same as before.