How .replace() works
The .replace() function in python replaces all occurances of a string with another string.
Syntax
The .replace() function is used like this:
string.replace(target,newstring [, count])
Demonstration
For example, if we wanted to replace all of the "a"s in "ahahahaha" with "bah"s, we would use the following code below:
#define the string we want to replace
string = "ahahahaha"
string = string.replace("a","bah")
print(str)
This would output:
"bahhbahhbahhbahhbah"