easytree#

A recursive dot-styled defaultdict to read and write deeply-nested trees

https://img.shields.io/badge/python-3.6%20%7C%203.7%20%7C%203.8%20%7C%203.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue https://github.com/dschenck/easytree/workflows/easytree/badge.svg https://badge.fury.io/py/easytree.svg https://readthedocs.org/projects/easytree/badge/?version=latest https://img.shields.io/badge/code%20style-black-000000.svg https://codecov.io/gh/dschenck/easytree/branch/master/graph/badge.svg?token=CPJXDL17CB

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.

Table of contents#