As the title says. It's a tree data structure that I need to display using only text.
--something
----like ----thi开发者_如何学Pythons ------but more visually --------understandableWhat is the de facto way to do this as used maybe by CLIs etc?
There is a property on the TreeNode class called level. You could loop through all nodes and add a number of tab characters to the string for the node based on level. This would then indent your text according to the level of the node in the string.
精彩评论