[Baypiggies] itemgetter function unavailable in linux

Keith Goodman kwgoodman at gmail.com
Tue Jun 21 16:22:49 CEST 2011

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 element
> 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?

More information about the Baypiggies mailing list