I want to replace a text that has a start and an end with the text itself and a label:
def replace_at(label, start, end, txt):
"""Replace substring of txt from start to end with label"""
return ''.join((txt[:start], label, txt[end:]))
In this way, I get the label in place of the text but would like the text too. So the current output for "Hi my name is", with name that is labelled, is:
Hi my LABEL is
And I would like
Hi my name LABEL is