dictionary: sorting the values preserving the order

Luis M. Gonzalez luismgz at gmail.com
Fri Apr 1 08:19:13 EST 2005


Another alternative:

d1 = {'a':4,'b':5,'c':1,'d':2,'e':3­}

il=[(v,k) for k,v in d1.items()]
il.sort()




More information about the Python-list mailing list