summaryrefslogtreecommitdiffstats
path: root/examples/save_tree_2_file.py
blob: 3b564f5313da9c4797b9c188ff789a8f5f67b5a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
# -*- coding: utf-8 -*-

from treelib import Tree

tree = Tree()
tree.create_node("Harry", "harry")  # root node
tree.create_node("Jane", "jane", parent="harry")
tree.create_node("Bill", "bill", parent="harry")
tree.create_node("Diane", "diane", parent="jane")
tree.create_node("Mary", "mary", parent="diane")
tree.create_node("Mark", "mark", parent="jane")
tree.save2file("tree.txt")