d={ 3: 4, 1: 1, 0: 0, 4: 3, 2: 1 } y=dict(sorted(d.items(), key=lambda item: item[1])) print(y) # {0: 0, 2: 1, 1: 2, 4: 3, 3: 4}