I am sure there is an easy and obvious way to do this, but I have been googling and reading the docs and I just cannot find anything.
This is what I want to achieve:
import itertools la = ['a1', 'a2', 'a3', 'a4'] lb = ['b1', 'b2'] for i, j in zip(la, itertools.cycle(lb)): print('_'.join((i,j)))