0

re.sub question

Is there a way to sub two different characters in one line. Here is how I did it to remove brackets from a string. formulas = re.sub("\(","",input()) formulas = re.sub("\)","",formulas).split()

30th Mar 2020, 1:22 AM
DAYLINER BAND
DAYLINER BAND - avatar
1 Respuesta
+ 1
import re mystring = "hello )world( just a) test(" print(re.sub("[()]", '', mystring))
30th Mar 2020, 4:51 AM
rodwynnejones
rodwynnejones - avatar