24 comments

[ 2.1 ms ] story [ 71.2 ms ] thread
Takes up too much (vertical) space.
I agree - perhaps there should be an option to control where and if you want to have the vertical and horizontal lines?
Isn't that exactly what tabulate has been doing very well for a while? https://pypi.python.org/pypi/tabulate

Note the variety of formats: 'ascii', but also html, latex & co.

Tabulate is also excellent for the command line tool it provides, I use it to convert csv output into tables for GH comments all the time.
PrettyTable is an established library which does the same: https://code.google.com/p/prettytable/
The introduction is almost identical: '[Pylsy/PrettyTable] is a simple Python library designed to make it quick and easy to represent tabular data in visually appealing ASCII tables'
I noticed that too. The copy paste is strong in this one.
I've used PrettyTable for years. I don't see how this improves upon it
Cool!

Sorry for the plug, but this gawk program does something similar:

https://github.com/joepvd/table

Field splitting can be defined with all of (g)awks possibilities. Features different styles, among which unicode table borders.

Nice utility! I've written a quick clone of it in Tcl for use on systems without GNU Awk: http://wiki.tcl.tk/41682.
Aha! That must have been the first time I have tried to read Tcl for more than a minute :) Looks like one can prototype fast in this language. Thanks for writing / posting!
Incredible how everyone in this thread has a different opinion on what is the best python library that works with table.
Yeah. Probably, the reason is that you can code it easily in few hundred lines and it looks decent and cool.
Judging by this thread there are a surprising number of tools dedicated to this. Typically when I need tabular output I stick the data into a Pandas dataframe and its output format is usually good enough.
I've tried several of similar libraries, and still find `tabulate` the best.
To do this, I would just tab-delimit stdout and pipe through `column -t`. Though I can see how a dedicated lib would be better for some use cases.