Re: Sort dictionary by value when value is a list

2008-11-14 Thread Chris Rebert
On Fri, Nov 14, 2008 at 10:26 AM, major-john <[EMAIL PROTECTED]> wrote: > I'm having trouble sorting a dictionary based on values when the values are > all lists, and i want to sort the list by key with the largest value lists > in decreasing size. > > Currently, I have the following: > > from oper

Re: Sort dictionary by value when value is a list

2008-11-14 Thread Vlastimil Brom
2008/11/14 major-john <[EMAIL PROTECTED]> > I'm having trouble sorting a dictionary based on values when the values are > all lists, and i want to sort the list by key with the largest value lists > in decreasing size. > > Currently, I have the following: > > from operator import itemgetter > > di

Sort dictionary by value when value is a list

2008-11-14 Thread major-john
I'm having trouble sorting a dictionary based on values when the values are all lists, and i want to sort the list by key with the largest value lists in decreasing size. Currently, I have the following: from operator import itemgetter dict = {'A': [(10, 20), (12, 18), (5, 11), (18, 25)], 'C': [