I want to place an element alternatively between any two elements of a list.
l1 = list('abcde') fill = 'z'
How it should look like:
['a', 'z', 'b', 'z', 'c', 'z', 'd', 'z', 'e']
fill = 'z' l2 = [fill]*(len(l1)-1) [x for t in map(None, l1, l2) for x in t if x]
Is there a better approach, i.e. that doesn't need to create another list?