easytree#
A recursive dot-styled defaultdict to read and write deeply-nested trees
Quickstart#
Installing easytree
is simple with pip:
pip install easytree
Simply import easytree
and create nested dict
nodes on the fly using the dot notation
>>> import easytree
>>> tree = easytree.dict()
>>> tree.foo.bar.baz = "Hello world!"
>>> tree
{
"foo": {
"bar": {
"baz": "Hello world!"
}
}
}
Or use a list method such as append
to dynamically cast a new node as a list
>>> tree = easytree.dict()
>>> tree.foo.bar.baz.append("Hello world!")
>>> tree
{
"foo": {
"bar": {
"baz": ["Hello world!"]
}
}
}
Find out more about what easytree
can do on the Getting Started page.