Skip to main content

'dtree': Linux 'tree' but for dictionaries

Project description

dtree: Linux tree but for dictionaries

Dictionaries are fun and useful!. But just like a folder structure, they can be multitiered storing all kinds of things in nested hierarchies. tree is a Linux utility that prints the multilevel structure of directories as a beautiful tree. dtree does the same but for dictionaries.

Example

Consider the following dictionary

dictionary = { "A": { "B": { "C": 0, "D": "some-string" }, "E": None }, "F": { "G": 0.0, "H": set([]) } }

Using dtree you can print the tree structure in different ways:

Demo

Installation

This utility can be installed directly from PyPI as:

pip install dict-metalcycling

For local installations intended for development, from the top of this repository run:

pip install -e .

Known limitations

This version currenly prints the str representation of the dictionary keys for the nodes of the tree. When keys are custom class objects, printing them could be very verbose so that would cause issues with the printed tree. I'll fix this in future PRs.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dtree-metalcycling-0.4.1.tar.gz (148.2 kB view hashes)

Uploaded Source

Built Distribution

dtree_metalcycling-0.4.1-py3-none-any.whl (11.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page