Answers for "sort python dictionary documentation"

2

sort a dictionary

from operator import itemgetter
new_dict = sorted(data.items(), key=itemgetter(1))
Posted by: Guest on September-24-2020

Python Answers by Framework

Browse Popular Code Answers by Language