MCPcopy Create free account
hub / github.com/dabeaz-course/python-mastery / print_table

Function print_table

Solutions/3_5/tableformat.py:3–7  ·  view source on GitHub ↗
(records, fields, formatter)

Source from the content-addressed store, hash-verified

1# tableformat.py
2
3def print_table(records, fields, formatter):
4 formatter.headings(fields)
5 for r in records:
6 rowdata = [getattr(r, fieldname) for fieldname in fields]
7 formatter.row(rowdata)
8
9class TableFormatter:
10 def headings(self, headers):

Callers 1

stock.pyFile · 0.90

Calls 2

headingsMethod · 0.45
rowMethod · 0.45

Tested by

no test coverage detected