Write a function to replace all occurances of a substring in a string
Topic: Write a function to replace all occurances of a substring in a string
Solution
str1 = "Hello! It is a Good thing" substr1 = "Good" substr2 = "bad" replaced_str = str1.replace(substr1, substr2) print("String after replace :" + str(replaced_str))
List all Python Programs