Combining arbitrary lists
Mariano Draghi
mdraghi at prosud.com
Sun Nov 14 22:57:03 EST 2004
Nick wrote:
> Given that
>
> n = [ [1, 2, 3], [4, 5, 6], [7, 8] ]
>
> then the following code produces what I expect
>
> for x in n[0]:
> for y in n[1]:
> for z in n[2]:
> print [x, y, z]
...
>
> How can I do this for an arbirary length of n?
I think this is what you're looking for:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/302478
> Muchos Gracias
De nada ;)
--
Mariano
More information about the Python-list
mailing list