猛图www.omeng.org
不说 上代码 做笔记
import operator
x = [{2: 2}, {2: 4}, {2: 3}, {2: 1}, {2: 0}]
sorted_x = sorted(x.__iter__(), key=operator.itemgetter(2))
>>> sorted_x[{2: 0}, {2: 1}, {2: 2}, {2: 3}, {2: 4}]