Skip to main content

pprint_tree

prints tree (where nodes have multiple children) in human readable format

Installation

pip install pprint_tree

Quickstart

class Node:
    def __init__(self, val):
        self.val = val
        self.children = []

root = Node("apple")
root.children.append(Node("orange"))
root.children.append(Node("pear"))
root.children.append(Node("pineapple"))
root.children.append(Node("banana"))
root.children[0].children.append(Node("orange1"))
root.children[0].children.append(Node("orange2"))
root.children[1].children.append(Node("pear1"))
root.children[1].children[0].children.append(Node("pear2"))
root.children[1].children[0].children[0].children.append(Node("pear3"))
root.children[1].children[0].children[0].children.append(Node("pear4"))
root.children[2].children.append(Node("kiwi"))
root.children[2].children.append(Node("avocado"))
root.children[2].children.append(Node("cherry tomatoes"))
root.children[2].children.append(Node("golden kiwi"))
root.children[2].children.append(Node("soup"))


from pprint_tree import pprint_tree

pprint_tree(root)

"""
            ____________________________________________apple__________________________________________
            |                        |                                   |                            |
    _____orange_______             pear           ___________________pineapple__________________   banana
    |                |              |             |       |            |              |        |
orange1          orange2         pear1          kiwi  avocado  cherry tomatoes  golden kiwi  soup
                                   |
                             ____pear2_______
                             |              |
                          pear3          pear4
"""

Release files for pprint-tree 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pprint-tree 0.0.3
File Size Uploaded
pprint_tree-0.0.3.tar.gz 5.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pprint-tree 0.0.3
File Interpreter ABI Platform
pprint_tree-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 11.0 kB

Release files / pprint_tree-0.0.3.tar.gz

Download URL pprint_tree-0.0.3.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
eb02d1c978af1bdfb9d0bcb4579964f8c3d50e6de2d408892aa95148e97ed116
BLAKE2b-256 checksum
How to use checksums
d386e86bf1c8ba753d977ed3b3b4250cf0d8c00f100d0be282b41d9e430f76dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.13.0

Release files / pprint_tree-0.0.3-py3-none-any.whl

Download URL pprint_tree-0.0.3-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d4fb98fb44588233060742a1f041dbae3e10999b26863ba6412823a535cebf09
BLAKE2b-256 checksum
How to use checksums
25fc2d88666d71bb42fbd34b2f0c5bdb9f84b50a07e9b70f9084b241d069dc32
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.13.0

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page