Learn Python
Strings
3.15
Lesson

Replacing a character or word in a string

We can replace a character or a complete word in a string using the function replace.

In the example below, we have replaced the word Mango with Apple.

We can also replace an individual character.