d = {5: "fifth", 3: "third", 2: "second", 1: "first"}l = list()for k,v in d.items(): l.append([k, v]) l.sort(key=lambda l: l[0])print(l)