mathieu a écrit :
Hi there,

  just trying to figure out how to iterate over two array without
computing the len of the array:

  A = [1,2,3]
  B = [4,5,6]
  for a,b in A,B: # does not work !
    print a,b

It should print:

  1,4
  2,5
  3,6

for a, b in zip(A, B):
    print a, b

or, using itertools (which might be a good idea if your lists are a bit huge):

from itertools import izip
for a, b in izip(A, B):
    print a, b


--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to