Answers for "replace exact word using re in python"

0

python replace matching string

s = 'one two one two one'

# 1st argument: string to find
# 2nd argument: string to put in place

print(s.replace(' ', '-')) # one-two-one-two-one
Posted by: Guest on May-18-2021
0

find and replace subword in word python regex

result = re.sub(r"Pulp Fiction", "Forrest Gump", text)
Posted by: Guest on July-20-2020

Code answers related to "replace exact word using re in python"

Python Answers by Framework

Browse Popular Code Answers by Language