17 lines
448 B
Python
17 lines
448 B
Python
from .formatter import TableFormatter
|
|
|
|
|
|
class HTMLTableFormatter(TableFormatter):
|
|
def _cell(self, value, tag):
|
|
return f"<{tag}>{value}</{tag}>"
|
|
|
|
def _printer(self, data, tag):
|
|
line = f"<tr>{' '.join(self._cell(str(value), tag) for value in data)}</tr>"
|
|
print(line)
|
|
|
|
def headings(self, headers):
|
|
return self._printer(headers, "th")
|
|
|
|
def row(self, rowdata):
|
|
return self._printer(rowdata, "td")
|