Table.as_text()

Render the table as a Markdown-style text table.

Usage

Source

Table.as_text()

Returns

str
The rendered table.

Examples

from tinytab import Table, fmt_currency

tbl = Table({"item": ["coffee", "bagel"], "price": [3.5, 2.25]})
print(tbl.fmt("price", fmt_currency).as_text())
| item   | price |
|--------|-------|
| coffee | $3.50 |
| bagel  | $2.25 |