- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathanytree-example.py
More file actions
Latest commit
27 lines (21 loc) · 570 Bytes
/
Copy pathanytree-example.py
File metadata and controls
27 lines (21 loc) · 570 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
fromanytreeimportNode, RenderTree
udo=Node("Udo")
marc=Node("Marc", parent=udo)
lian=Node("Lian", parent=marc)
dan=Node("Dan", parent=udo)
jet=Node("Jet", parent=dan)
jan=Node("Jan", parent=dan)
joe=Node("Joe", parent=dan)
print(udo)
Node('/Udo')
print(joe)
Node('/Udo/Dan/Joe')
forpre, fill, nodeinRenderTree(udo):
print("%s%s"% (pre, node.name))
print("Dan children")
print(dan.children)
(Node('/Udo/Dan/Jet'), Node('/Udo/Dan/Jan'), Node('/Udo/Dan/Joe'))
print("Jan depth")
print(jan.depth)
print("Jan siblings")
print(jan.siblings)