[Baypiggies] itemgetter function unavailable in linux
kpguy1975 at gmail.com
Tue Jun 21 16:23:57 CEST 2011
That's correct. Thanks.
On Tue, Jun 21, 2011 at 10:22 AM, Keith Goodman <kwgoodman at gmail.com> wrote:
> On Tue, Jun 21, 2011 at 7:08 AM, Vikram K <kpguy1975 at gmail.com> wrote:
> > I have a nested list of the type [['dog,10], ['cat',5], ['dragon',7]]
> > I need to sort this nested list based on the second element of each
> > in the nested list so that i end up with:
> > [['cat',5], ['dragon',7], ['dog',10]]
> > This used to be easy. Just use the itemgetter function in the itertools
> > module. But on my linux machine, to my horror, there is no itemgetter
> > function to be found in the itertools module.
> Is this the one you want: from operator import itemgetter?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Baypiggies