What would be the best way in Python to parse out chunks of text contained in matching brackets?
\"{ { a } { b } { { { c } } } }\"
should i
Or this pyparsing version:
>>> from pyparsing import nestedExpr >>> txt = "{ { a } { b } { { { c } } } }" >>> >>> nestedExpr('{','}').parseString(txt).asList() [[['a'], ['b'], [[['c']]]]] >>>