sorting a dictionary

user at domain.invalid user at domain.invalid
Wed Feb 19 03:32:37 EST 2003


Suppose I have dictionary (associative arry) with people's names and
ages, like

     names = {"Bob":27, "Larry":35, "Curly":65, "Moe":66, "Jeff":31,
              "Guido":34, "Parrot":36}

How can I sort this? And what does the method "names.keys().sort()"
actually do?





More information about the Python-list mailing list