Pretty Table for Python Link

Holy cow this is awesome! Pretty Table is a Python library for creating plain text formatted tables from HTML, CSV, SQL or even row by row insertions.

Take an HTML table with table and td tags:

:::python
from prettytable import from_html
pts = from_html(html_string)

And output it in plain text

:::text
+-----------+------+------------+-----------------+
| City name | Area | Population | Annual Rainfall |
+-----------+------+------------+-----------------+
| Adelaide  | 1295 |  1158259   |      600.5      |
| Brisbane  | 5905 |  1857594   |      1146.4     |
| Darwin    | 112  |   120900   |      1714.7     |
| Hobart    | 1357 |   205556   |      619.5      |
| Sydney    | 2058 |  4336374   |      1214.8     |
| Melbourne | 1566 |  3806092   |      646.9      |
| Perth     | 5386 |  1554769   |      869.4      |
+-----------+------+------------+-----------------+

I’d love to see it offer output as a Multimarkdown table too.

By way of Tim Hopper