Don't forget to also checkout my second blog containing articles to all other related ICT topics!!

Thursday, May 3, 2012

Itertools product method explained

Itertools product returns the Cartesian product of the input iterables.
from itertools import product

print list(product('ABC',[2,3]))

[('A', 2), ('A', 3), ('B', 2), ('B', 3), ('C', 2), ('C', 3)]

No comments:

Post a Comment