kdt kdt - 2 months ago 12
Python Question

How can I pretty-print ASCII tables with Python?

I'm looking for a Python library for printing tables like this:

| column 1 | column 2 |
| value1 | value2 |
| value3 | value4 |

I've found asciitable but it doesn't do the borders etc. I don't need any complex formatting of data items, they're just strings. I do need it to auto-size columns.

Does such a thing exist, or do I need to spend a few minutes writing my own?

kdt kdt

For some reason when I included 'docutils' in my google searches I stumbled across texttable, which seems to be what I'm looking for.