sorting a dictionary
user at domain.invalid
user at domain.invalid
Thu Feb 20 03:08:46 EST 2003
Rene Pijlman wrote:
> user at domain.invalid:
>
>>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?
>
>
> This is explained in:
> http://www.python.org/peps/pep-0265.html
>
How about creating a sorted dictionary then? That is, add elements
to the dictionary in the order they are supposed to be in.
Is that not possible?
More information about the Python-list
mailing list