texttree is a basic python module for parsing textual representations of trees of strings which use indentation to indicate nesting - like the following:
There are two interesting functions in texttree: build_tree and build_forest.
Given a string containing a textual representation of a tree
build_tree
this returns a texttree.Tree object, containing string values.
build_forest is like build_tree but will a single string consisting of several concatenated tree representations and
return a list of trees.
Indentation, trailing or leading whitespace, and trailing whitspace on lines is stripped.
easy_install texttree
The following code parses a text tree and turns it into an HTML nested list representing this tree.