Answers for "python replace matching string"

2

python regex substitute

import re
s = "Example String"
replaced = re.sub('[ES]', 'a', s)
print replaced
Posted by: Guest on July-10-2020
0

replacing a value in string using aregular expression pyhton

import re

s = '[email protected] [email protected] [email protected]'

print(re.sub('[a-z]*@', 'ABC@', s))
# [email protected] [email protected] [email protected]
Posted by: Guest on October-13-2020
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

Code answers related to "python replace matching string"

Python Answers by Framework

Browse Popular Code Answers by Language