Say I have these three lists:
aList = [1,2,3,4,5,6]
bList = ['a','b','c','d']
cList = [1,2]
and I want to iterate over them using zip
.
By using cycle with zip
as following:
from itertools import cycle
for a,b,c in zip(aList, cycle(bList), cycle(cList)):
print a,b,c
I get the result as:
1 a 1
2 b 2
3 c 1
4 d 2
5 a 1
6 b 2
Though I want my result to be like:
1 a 1
2 b 1
3 c 1
4 d 1
5 a 2
6 b 2