list 2 dict?

Benjamin Kaplan benjamin.kaplan at case.edu
Sun Jan 2 16:56:15 EST 2011


On Jan 2, 2011 4:15 PM, "Octavian Rasnita" <orasnita at gmail.com> wrote:
>
>
> Octavian
>
> ----- Original Message -----
> From: "Alex Willmer" <alex at moreati.org.uk>
> Newsgroups: comp.lang.python
> To: <comp.lang.python at googlegroups.com>
> Cc: <python-list at python.org>
> Sent: Sunday, January 02, 2011 8:07 PM
> Subject: Re: list 2 dict?
>
>
> > On Sunday, January 2, 2011 3:36:35 PM UTC, T wrote:
> >> The grouper-way looks nice, but I tried it and it didn't work:
> >>
> >> from itertools import *
> >> ...
> >> d = dict(grouper(2, l))
> >>
> >> NameError: name 'grouper' is not defined
> >>
> >> I use Python 2.7. Should it work with this version?
> >
> > No. As Ian said grouper() is a receipe in the itertools documentation.
> >
> > http://docs.python.org/library/itertools.html#recipes
>
> I know that, that is why I used:
>
> from itertools import *
>
>
> Isn't enough?
>
> Octavian
>

It would be, if, the function was actually a part of the itertools module.
It isn't. It's just a code example used in the documentation.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110102/1ca0e7e2/attachment.html>


More information about the Python-list mailing list