Replacing Substrings: replace() in Python


Replace parts of a string with something else.

Source Code

greeting = "Hello, world!"
new_greeting = greeting.replace("world", "Python")
print(new_greeting)
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments