+ 1

How do I use re.sub in Regex to replace"
quot; with "S"?

I tried to replace the meta character "

quot; in a text, but I'm not able to do so. Can anyone help me with this?

17th Jun 2019, 2:55 PM
thiru mal
thiru mal - avatar
3 Réponses
+ 4
Did you use \ before the dollar sign in your regular expression?
17th Jun 2019, 4:01 PM
Airree
Airree - avatar
+ 5
import re s = '$hort' s = re.sub(r'\
#x27;, r'S', s)
17th Jun 2019, 4:13 PM
Anna
Anna - avatar
0
Thank you both 😊 got it✌🏼
18th Jun 2019, 9:26 AM
thiru mal
thiru mal - avatar