In python how to search and replace in strings?
This is my code, I want to replace 'python'
with 'Java'
#!/usr/bin/env python3
find_it = "python"
repl_it = "Java"
text = "python is amazing. I love python, it is the best language. python is the most readable language."
if text.find(find_it):
text = text.replace(find_it, repl_it)
print(text)
The output is still the same:
python is amazing. I love python, it is the best language. python is the most readable language.
How to replace words in a string?