Or this pyparsing version:
>>> from pyparsing import nestedExpr
>>> txt = "{ { a } { b } { { { c } } } }"
>>>
>>> nestedExpr('{','}').parseString(txt).asList()
[[['a'], ['b'], [[['c']]]]]
>>>
More Related Contents:
- Retrieving parameters from a URL
- How can I split and parse a string in Python?
- Flatten list of lists [duplicate]
- Difference between parsing a text file in r and rb mode
- using lxml and iterparse() to parse a big (+- 1Gb) XML file
- TypeError: expected a character buffer object – while trying to save integer to textfile
- Searching text in a PDF using Python?
- Malformed String ValueError ast.literal_eval() with String representation of Tuple
- Convert fraction to float?
- How to create a dictionary from a line of text?
- Python code to remove HTML tags from a string [duplicate]
- Python BeautifulSoup XML Parsing
- Creating a tree/deeply nested dict from an indented text file in python
- How to parse/read a YAML file into a Python object?
- Using isdigit for floats?
- How to extract information between two unique words in a large text file
- How to parse a string and return a nested array?
- How can I split a URL string up into separate parts in Python?
- Simple CSV to XML Conversion – Python
- Is there a built-in or more Pythonic way to try to parse a string to an integer
- How can I parse (read) and use JSON in Python?
- Python urlparse — extract domain name without subdomain
- fuzzy timestamp parsing with Python
- Resources for lexing, tokenising and parsing in python
- Pretty print in lxml is failing when I add tags to a parsed tree
- How to parse complex text files using Python?
- Split string at commas except when in bracket environment
- Why is ElementTree raising a ParseError?
- Python string operation, extract text between html tags
- Python Parse CSV Correctly