pythonUsing string replace()
yourString.replace(oldvalue, newvalue, count)
ctrl + c
.replace( replaces specific phrase with other specified phrase (does not require any imports) |
Usage example
sentence = "I like Apple"
y = sentence.replace("Apple","Pear")
print(y)
output
I like Pear
More of Python
- How to get minutes from datetime
- How to open CSV file
- Combine multiple txt files into one
- How to read yaml file
- How to get data from Mysql
- How to add an element to the list
- Join list elements into string
- How to view object attributes
- How to query json
- How to split string by length
See more codes...