Answers for "sort dictionary by id"

0

sort dictionary by values

from collections import OrderedDict
dd = OrderedDict(sorted(d.items(), key=lambda x: x[1]))
print(dd)
Posted by: Guest on November-17-2020

Python Answers by Framework

Browse Popular Code Answers by Language