I am learning python and trying to sort dicts in the simplest way and its throwing errors
d = {'a':10,'b':1,'c':22}
print (d.items())
t = d.items()
t.sort()
print (t)
And it throws me the below error
dict_items([('b', 1), ('a', 10), ('c', 22)])
Traceback (most recent call last):
File "/Users/bash/Downloads/n.py", line 5, in <module>
t.sort()
AttributeError: 'dict_items' object has no attribute 'sort'
Yes, I googled and stackoverflow did not give the results I am looking for so it would be great if you dont down vote this question and give an answer if possible.