dict sorted by value. According to the dictionary sort value

d = [('a', 24), ('g', 52), ('i', 12)]

print(sorted(d),key = lambda x:x[1])

 

sorted (dictionaries, sorted by: dictionary [key])

Guess you like

Origin www.cnblogs.com/crave/p/11105641.html