ASCII Tree Generator
asciitree is a Python library that enables the drawing of tree structures using ASCII characters directly in the terminal. It is currently at version 0.3.3, with its last release in 2016, suggesting a maintenance or inactive release cadence.
Warnings
- deprecated The library has not been updated since September 2016. While it functions, it may not receive further bug fixes or new features and might have compatibility issues with very recent Python versions or dependencies not yet discovered.
- gotcha The library explicitly states support only for Python 3. Attempting to use it with Python 2 environments will likely result in errors.
- gotcha There are multiple Python, Go, and JavaScript libraries that share the 'asciitree' or 'ascii tree' name. Ensure you are importing and using the correct Python library 'asciitree' by Marc Brinkmann (mbr).
Install
-
pip install asciitree
Imports
- LeftAligned
from asciitree import LeftAligned
Quickstart
from asciitree import LeftAligned
from collections import OrderedDict as OD
tree_data = {
'root': OD([
('child1', {
'grandchild1_1': {},
'grandchild1_2': {'subgrandchild': {}}
}),
('child2', {
'grandchild2_1': {},
}),
('child3', {})
])
}
tr = LeftAligned()
print(tr(tree_data))