Iterating over multiple lists (a newbie question)
Victor Muslin
victor at prodigy.net
Wed Jan 3 16:59:37 EST 2001
This may be rather silly, but I can't think of a clever way...
To traverse a single list the code is:
for item in list:
print item
However, if there are multiple lists (of the same length) is there a
cleverer way to do the following:
for i in range(0,len(list1)):
print list1[i], list2[i]
I would like something like this (which obviously does not work):
for one,two in list1, list2:
print one,two
TIA
More information about the Python-list
mailing list