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 swap two variables values
- Combine multiple txt files into one
- How to split string by space
- How to use proxy
- How to add an element to the list
- How to get data from Mysql
- How to set environment variables
- How to get yesterday's date
- How to get minutes from datetime
- One-liner if else
See more codes...