I am new to regex. How can I remove the spaces in the beginning and the end in this context.
a = "( a is a b )"
I was trying
re.sub(r"\([(\s*\w+\s*)]*\)",r"",a)
But I managed to write some for the pattern but for the replacement I couldn't get any idea. I am not sure, if it is correct for the pattern as well. Need your kind support. Thanks for your help.