order a dictionary code example Example: sort a dictionary from operator import itemgetter new_dict = sorted(data.items(), key=itemgetter(1))