Help with dictionary

Jim Shady iamshady at rediffmail.com
Thu Jun 5 03:01:17 EDT 2003


Hello,

I have a dictionary of the sort:

{(1, (21353, 21418)): 3900, (2, (53006, 53164)): 3800, (0, (19697,
19763)): 4100}

I need to re-sort this dictionary with the first element of the tuple
in the keys. A sorted dictionary of the above would be:

{(0, (19697, 19763)): 4100, (1, (21353, 21418)): 3900, (2, (53006,
53164)): 3800}

Could somebody help me with the algorithm/logic to accomplish this?

Thanks in advance!

Jim




More information about the Python-list mailing list