remove invalid parentheses python code example
Example 1: remove all parentheses from string python
>>> table = str.maketrans({"(":None, ")":None})
Example 2: remove all parentheses from string python
>>> table = str.maketrans(dict.fromkeys("()"))
>>> string1 = '(this) (is) (a) (test)'
>>> string1.translate(table)
'this is a test'