$ 0 0 Easy way if you are sure that your keys will be integers:d = {key: value for key, value in sorted(d.items())}