値を昇順に並べる(小さい順に)
dict = {"a": 0, "b": 42, "c": 1, "d": -196}
for k in sorted(dict, key=lambda k:dict[k]):
print(k, dict[k])
値を降順に並べる(大きい順に)
dict = {"a": 0, "b": 42, "c": 1, "d": -196}
for k in sorted(dict, key=lambda k:dict[k], reverse=True):
print(k, dict[k])