Items tagged text

2016

  • Text Table in Python

    Python class to pretty-print tabluar data in a terminal.

    t = Table(titles=['Name', 'Position', 'Goals'])
    t.add_row(['Dave Smith', 'striker', 12])
    t.add_row(['Angus McGregor', 'full back', 1])
    print(t)
    

    produces:

         Name      | Position  | Goals
    ----------------------------------
    Dave Smith     | striker   |    12
    Angus McGregor | full back |     1