howto handle nested for

Peter Pearson ppearson at nowhere.invalid
Fri Sep 28 21:15:24 EDT 2012


On Fri, 28 Sep 2012 09:49:36 -0600, Ian Kelly <ian.g.kelly at gmail.com> wrote:
>
> levels = 6
> for combination in itertools.product(xrange(n_syms), levels):
>     # do stuff

>>> n_syms = 3
>>> levels = 6
>>> for combination in itertools.product(xrange(n_syms), levels):
...   print combination
... 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'int' object is not iterable


-- 
To email me, substitute nowhere->spamcop, invalid->net.



More information about the Python-list mailing list