Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
from anytree import Node, RenderTree
grandpa = Node('Grandpa')
father = Node('Father', parent=grandpa)
uncle = Node('Uncle', parent=grandpa)
child = Node('Child', parent=father)
sibling = Node('Sibling', parent=father)
for pre, fill, node in RenderTree(grandpa):
print("%s%s" % (pre, node.name))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.