【Python基础】之对字典进行排序操作(sort by the values of dict)

来源:互联网 发布:怎样成为一名网络作家 编辑:程序博客网 时间:2024/06/01 21:09

import operatorresult = sorted(dict.items(), key = operator.itemgetter(1))

The type of result is "list" and is sorted by the values of dict in ascending order.