def replace(seq, to_replace, fill):
    fill = iter(fill)
for element in seq:
    if element != to_replace:
        yield element
else:
    yield next(fill, element)
Replace one item in a string with one item from a list