Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tree-format

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tree-format

  • 0.1.2
  • PyPI
  • Socket score

Maintainers
2

Python library to generate nicely formatted trees, like the UNIX tree command.

Example

Produce output like this:

foo
├── bar
│   ├── a
│   └── b
├── baz
└── qux
    └── c⏎
        d

using code like this:

from operator import itemgetter

from tree_format import format_tree

tree = (
    'foo', [
        ('bar', [
            ('a', []),
            ('b', []),
        ]),
        ('baz', []),
        ('qux', [
            ('c\nd', []),
        ]),
    ],
)

print format_tree(
    tree, format_node=itemgetter(0), get_children=itemgetter(1))

License

This is made available under the Apache Software License, version 2.0.

Copyright (c) 2015 - Jonathan M. Lange

Testing

Run tests with:

python -m testtools.run discover

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc