# Loop through dictionary in key order di = {'b': 2, 'c': 3, 'a': 1} for k, v in sorted(di.items()): print(k, v) # a 1 # b 2 # c 3