Created
May 19, 2020 09:39
-
-
Save Allwin12/0824c1b19f81c1dc5552f2d3f1dafc39 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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