Similar to this question, but instead of replacing one item with another, I\'d like to replace any occurrences of one item with the contents of a list.
orig
No need for anything fancy:
desired = orig[:2] + repl + orig[3:]
To find 2 you can search for orig.index('c').
2
orig.index('c')
x = orig.index('c') desired = orig[:x] + repl + orig[x+1:]
if repl is not a list, just use list(repl)
list(repl)