Ordered dictionary?
Leif K-Brooks
eurleif at ecritters.biz
Thu Jan 22 16:21:00 EST 2004
Josiah Carlson wrote:
>> I need to associate a string (key) with an integer (value). A
>> dictionary would do the job, except for the fact that it must be
>> ordered. I also need to look up the value for a specific key easily,
>> so a list of tuples wouldn't work.
>
>
> How must the dictionary be ordered? Do you need the keys or the values
> sorted?
Sorry for not making that clear, I need it sorted by the order of
insertion. Looks like
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/107747 might do
what I want...
More information about the Python-list
mailing list