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

Function print_table

Solutions/3_2/tableformat.py:4–8  ·  view source on GitHub ↗
(records, fields)

Source from the content-addressed store, hash-verified

2
3# Print a table
4def print_table(records, fields):
5 print(' '.join('%10s' % fieldname for fieldname in fields))
6 print(('-'*10 + ' ')*len(fields))
7 for record in records:
8 print(' '.join('%10s' % getattr(record, fieldname) for fieldname in fields))

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected