(Référence) Toutes les données d'arbre Python http://anytree.readthedocs.io/en/latest/index.html#any-python-tree-data (Référence) Python Tree Data Release 2.1.4 c0fec0de 12 mai 2017 https://media.readthedocs.org/pdf/anytree/latest/anytree.pdf#page=18
from anytree import *
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(RenderTree(udo, style=AsciiStyle()).by_attr())
print('-------------------------------------------------')
from anytree.dotexport import RenderTreeGraph
RenderTreeGraph(udo).to_dotfile("tree.dot")
from subprocess import check_call
check_call(['dot','-Tpng','tree.dot','-o','OutputFile.png'])
Recommended Posts