You can also Use below method if you have to replace string between specific index
def Replace_Substring_Between_Index(singleLine,stringToReplace='',startPos=0,endPos=1):
try:
singleLine = singleLine[:startPos]+stringToReplace+singleLine[endPos:]
except Exception as e:
exception="There is Exception at this step while calling replace_str_index method, Reason = " + str(e)
BuiltIn.log_to_console(exception)
return singleLine