list 2 dict?
Octavian Rasnita
orasnita at gmail.com
Sun Jan 2 16:04:10 EST 2011
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
More information about the Python-list
mailing list