temp = {}
temp["A"] = 5.3
temp["B"] = 2.3
temp["C"] = 10.3

t1 = []
t1 = sorted(temp,key=temp.get,reverse=True)
print (t1)

t2 = []
t2 = sorted(temp.values(),reverse=True)
print (t2)

['C', 'A', 'B']
[10.3, 5.3, 2.3]
Retrieved from http://hyacinth.byus.net/moniwiki/wiki.php/Python/정렬 key-value pairs
last modified 2020-05-09 13:09:46