python中字典排序,列表中的字典排序 一.使用python模块:operator import operator #首先要导入模块operator x = {1:2, 3:4, 4:3, 2:1, 0:0} sorted_x = sorted(x.iteritems(), key=operator.itemgetter(1)) #按字典值排序(默认为升序) print(sorted_x) #[(0, 0), (2, 1), (1, 2), (4, 3), (3, 4)] sorted_x =