Answers for "python regex match and replace with"

21

python replace regex

import re
s = "Example String"
replaced = re.sub('[ES]', 'a', s)
print replaced 
# will print 'axample atring'
Posted by: Guest on March-13-2020
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

Python Answers by Framework

Browse Popular Code Answers by Language