Search code examples
pythoniteratortupleslist-comprehensionpython-itertools

Basic List of tuple iteration


hi all im stuck at my python script i have 2list a&b The list A contain tuple which iuse for looping trought the list The b contain only value that i want to increment so each time the "a" complete i want to return value

A=[(a,b,c),(a,b,c).(a,b,c),(a,b,c)]
B=["a","b","c",'d']
for x in a:
  Print " yo"
  itert=B.__iter()__
  Y=itert.next()
  print y

and its returning yo a,yo a,yo a,yo a yo b,yo b,yo b,yo b,yo b ...

But i want yo a,yo b,yo c,yo d, yo a,yo b,yo c,yo d ...

Sorry for the exeple but its the best way i can explain thx a lot


Solution

  • Yea im sorry ,im really not good in english what I meant is Iterating two list a the same time like

    for a,b in zip(listA,listB): print a,b

    Its basic list iteration im really sorry for my bad English and exemple