Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to remove text in brackets of python

>>> 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: #remove #text #brackets #python
ADD COMMENT
Topic
Name
1+5 =