For loop using more than one list in Python
Try:
from itertools import cycle
print('\n'.join("column-{}-fade-{}".format(x, y) for x, y in zip(column_width, cycle(fade))))
This is one approach using itertools.cycle
.
Ex:
from itertools import cycle
column_width = ["3", "3", "6", "8", "4", "4", "4", "4"]
fade = cycle(["100", "200", "300"])
for i in column_width:
print("column-{}-fade-{}".format(i, next(fade)))
Output:
column-3-fade-100
column-3-fade-200
column-6-fade-300
column-8-fade-100
column-4-fade-200
column-4-fade-300
column-4-fade-100
column-4-fade-200