Answers for "python sort by value first then key lexicography"

0

python sort by value first then key lexicography

>>> d = {'T': 1500, 'L': 1000, 'P': 1500, 'G': 6500, 'B': 7000}
>>> sorted(sorted(d), key=d.get, reverse=True)
['B', 'G', 'P', 'T', 'L']
Posted by: Guest on March-07-2021

Code answers related to "python sort by value first then key lexicography"

Python Answers by Framework

Browse Popular Code Answers by Language