Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python remove text between parentheses

# credit to the Stack Overflow user in the source link
>>> import re 
>>> x = "This is a sentence. (once a day) [twice a day]"
>>> re.sub("[([].*?[)]]", "", x)
'This is a sentence.  '
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #remove #text #parentheses
ADD COMMENT
Topic
Name
6+8 =