# 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. '
>>> table = str.maketrans({"(":None, ")":None})
>>> table = str.maketrans(dict.fromkeys("()"))
>>> string1 = '(this) (is) (a) (test)'
>>> string1.translate(table)
'this is a test'