我有三个等大小的列表(List1、2和3),我想遍历每个列表并对其中的每个项目执行操作,例如:
for x in List1, y in List2, z in List3:
if(x == "X" or x =="x"):
//Do operations on y
elif(y=="Y" or y=="y"):
//Do operations on x,z
我希望能够通过Python遍历列表 "List1或2或size的长度",然后对x、y和z执行操作。您该如何做到这一点呢?
编辑:Python版本为2.6.6
itertools
已经包含在 Python 2.6 中,您只需要导入它即可。 - Alasdair