Skip to main content

SOME DESCRIPTION

Project description

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
"""

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

pprint_tree-0.0.3.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pprint_tree-0.0.3-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file pprint_tree-0.0.3.tar.gz.

File metadata

  • Download URL: pprint_tree-0.0.3.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.0

File hashes

Hashes for pprint_tree-0.0.3.tar.gz
Algorithm Hash digest
SHA256 eb02d1c978af1bdfb9d0bcb4579964f8c3d50e6de2d408892aa95148e97ed116
MD5 ea5720539a7a3d960a811aa43a18157b
BLAKE2b-256 d386e86bf1c8ba753d977ed3b3b4250cf0d8c00f100d0be282b41d9e430f76dd

See more details on using hashes here.

File details

Details for the file pprint_tree-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: pprint_tree-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.0

File hashes

Hashes for pprint_tree-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d4fb98fb44588233060742a1f041dbae3e10999b26863ba6412823a535cebf09
MD5 06e97571cba462116ac66aacb0803b23
BLAKE2b-256 25fc2d88666d71bb42fbd34b2f0c5bdb9f84b50a07e9b70f9084b241d069dc32

See more details on using hashes here.

Supported by

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