对字典排序

a_dict = {'a': 1, 'c': 2, 'b': 3}

for a in sorted(a_dict.items(),key=lambda x:x[1]):
print(a)
posted @ 2018-11-12 21:47  猴子上树  阅读(108)  评论(0编辑  收藏  举报