Table.as_html()

Render the table as an HTML <table>.

Usage

Source

Table.as_html()

Returns

str
The rendered table, with all values HTML-escaped.

Examples

from tinytab import Table

tbl = Table({"item": ["coffee", "bagel"], "price": [3.5, 2.25]})
print(tbl.as_html())
<table class="tinytab">
  <thead>
    <tr><th>item</th><th>price</th></tr>
  </thead>
  <tbody>
    <tr><td>coffee</td><td>3.5</td></tr>
    <tr><td>bagel</td><td>2.25</td></tr>
  </tbody>
</table>