String.replace can be used in the following ways:
For Example:
val = 'This is a Cat'
print(val.replace('Cat','Dog'))
Output
This is a Dog
val = 'This is a Cat and this is a Dog and this is a Rat'
print(val.replace('this','here',3 ))
Output
This is a Cat and here is a Dog and here is a Rat
In the second case along with replace(old, new, step) is also mentioned. This indicates how many times I want the particular string to be replaced.
Also, Python is case sensitive, hence the initial This is not changed to here.
Hope this helps.