ASCII table with per column format specs, multi-line content, formatting directives, column width control.


Keywords
ascii, table, pretty, ascii-table
License
Apache-2.0
Install
pip install monotable==3.1.0

Documentation

monotable

ASCII table with per column format specs, multi-line content, formatting directives, column width control.

PyPI PyPI Python Versions

master branch status

Documentation Status on Read the Docs

Build Status on Travis CI

Code Coverage

Documentation | Homepage | Build | Codecov | License

Sample usage

from monotable import mono

headings = ['purchased\nparrot\nheart rate', 'life\nstate']

# > is needed to right align None cell since it auto-aligns to left.
# monotable uses empty string to format the second column.
formats = ['>(none=rest).0f']
cells = [[0, 'demised'],
         [0.0, 'passed on'],
         [None, 'is no more'],
         [-1],
         [0, 'ceased to be']]

print(mono(
    headings, formats, cells,
    title='Complaint\n(registered)',

    # top guideline is equals, heading is period, bottom is omitted.
    guideline_chars='=. '))

sample output:

       Complaint
      (registered)
========================
 purchased
    parrot  life
heart rate  state
........................
         0  demised
         0  passed on
      rest  is no more
        -1
         0  ceased to be