if substring in string, replace substring python code example
Example: python replace substring
txt = "I like bananas"
x = txt.replace("bananas", "apples")
print(x) # ----> I like apples
txt = "I like bananas"
x = txt.replace("bananas", "apples")
print(x) # ----> I like apples