remove brackets from string python code example
Example 1: 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. '
Example 2: how do i remove the brackets around a list in python
l = ['a', 2, 'c']
print str(l)[1:-1]
'a', 2, 'c'