fork download
  1. import operator
  2. x = {1: 2, 3: 4, 4: 3, 2: 1, 0: 0}
  3. sorted_x = sorted(x.items(), key=operator.itemgetter(1))
  4. print(sorted_x)
Success #stdin #stdout 0.02s 28376KB
stdin
Standard input is empty
stdout
[(0, 0), (2, 1), (1, 2), (4, 3), (3, 4)]