[Tutor] how to sort a dictionary by values

shawn bright nephish at gmail.com
Wed Aug 8 05:11:16 CEST 2007


hello there all,
i am wondering how to sort a dictionary that i have by values.
And i also need to sort them from greatest to least
like if i have a dictionary

d = {'a':21.3, 'b':32.8, 'c': 12.92}

how could i sort these from least to greatest
so that the order would turn out
b,a,c

thanks
shawn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070807/e518a643/attachment.html 


More information about the Tutor mailing list