Maybe I misunderstood something (as a dict has no inherited order of keys), but why not just print the dict using sort with key = str?
for key in sorted(my_dict, key=str): print(key, my_dict[key])Or eventually convert it to / use OrderedDict from collections to preserve order?
from collections import OrderedDict ord_dict = OrderedDict(((key, my_dict[key]) for key in sorted(my_dict, key=str)))