Serialize the tree with depth marking branches.
>>> for depth,node in a.thread():
- ... print "%*s" % (2*depth+1, node.n)
+ ... print('{}{}'.format(' '*2*depth, node.n))
a
b
d
branch splits.
>>> for depth,node in a.thread(flatten=True):
- ... print "%*s" % (2*depth+1, node.n)
+ ... print('{}{}'.format(' '*2*depth, node.n))
a
b
d
if __name__ == '__main__':
pt = python_tree(root_path='../hooke', root_modname='hooke')
for node in pt.traverse():
- print node.modname
+ print(node.modname)
make_module_txt(node.modname, [c.modname for c in node])