Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
import re
import sys
def main():
text = sys.argv[1]
pattern = re.compile(r'\([^\)]+$')
result = pattern.sub('', text)
if result:
print result
if __name__ == '__main__':
main()
What nonsense! ;-)
Why is the 1st '(' closed? ... then you get: 'dfd'.
In general, the bracket notation is parsed by pushing onto the stack by '(' and popping the level by ')'. See check bracket expression
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question