list 2 dict?

Alex Willmer alex at moreati.org.uk
Sun Jan 2 13:07:44 EST 2011


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

The module doesn't provide it directly



More information about the Python-list mailing list