fork download
  1. words = ['text', 'be', 'there']
  2. text = "This is an example [word]. Normally there would [word] something important here but [word] isn't."
  3. print(''.join(w for p in zip(text.split('[word]'), (*words, '')) for w in p))
Success #stdin #stdout 0.02s 9240KB
stdin
Standard input is empty
stdout
This is an example text. Normally there would be something important here but there isn't.