您需要这样的定制功能:
d = {'a': 4, 'c': 1, 'b': 2, 'd': 3} def sorteddict(d={}): return sorted(d.items(),key=lambda x: x[1]) print(sorteddict(d))