"Gal Diskin" <[EMAIL PROTECTED]> writes: > I am writing a code that needs to iterate over 3 lists at the same > time, i.e something like this: > > for x1 in l1: > for x2 in l2: > for x3 in l3: > print "do something with", x1, x2, x3
This does look a little kludgy (untested): for x1,x2,x3 in ((x1,x2,x3) for x1 in l1 for x2 in l2 for x3 in l3): print "do something with", x1, x2, x3 -- http://mail.python.org/mailman/listinfo/python-list