How to use str.replace in Python

The str.replace() function replaces all occurrences of a substring in a string.

Solution for How to use str.replace in Python : You can use str.replace() to replace a substring in a string Call str.replace(old, new) to replace the substring old with the substring new in a string. This will replace all occurrences of the original substring.

Specify count in str.replace(old, new, count) to replace the first count occurrences of old with new in a string.

a_string = "abaa"