Lists aggregation

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Mon Mar 16 19:17:21 CET 2009


mattia:
> Now, some ideas (apart from the double loop to aggregate each element of
> l1 with each element of l2):

>>> from itertools import product
>>> list(product([1,2,3], [4,5]))
[(1, 4), (1, 5), (2, 4), (2, 5), (3, 4), (3, 5)]

Bye,
bearophile



More information about the Python-list mailing list