22
loading...
This website collects cookies to deliver better user experience
string.replace(old, new, count)
# use of replace() method
string = "Join our community of top freelancers"
# replace "top" with "top 1%"
print(string.replace("top", "top 1%"))
# printing the original string
print(string)
Join our community of top 1% freelancers
Join our community of top freelancers
string = "python is a programming language"
# replace "p" with "P" once
print(string.replace("p", "P",1))
# replace "p" with "P" once
print(string.replace("p", "P"))
Python is a programming language
Python is a Programming language