【发布时间】:2012-08-09 14:08:46
【问题描述】:
可能重复:
In Python how do I sort a list of dictionaries by values of the dictionary?
Sorting Python dictionary based on nested dictionary values
我有如下形式的字典:
a_dict = { 'e': (1, 100), 'a': (2, 3) }
我无法按元组的第二个元素对其进行排序。结果字典将如下所示:
a_dict = { 'a': (2, 3), 'e': (1, 100) }
【问题讨论】:
-
@Tichodroma:这是一个字典列表,这只是一个字典,不在列表中。