(records, fields)
| 2 | |
| 3 | # Print a table |
| 4 | def print_table(records, fields): |
| 5 | # Print the table headers in a 10-character wide field |
| 6 | for fieldname in fields: |
| 7 | print('%10s' % fieldname, end=' ') |
| 8 | print() |
| 9 | |
| 10 | # Print the separator bars |
| 11 | print(('-'*10 + ' ')*len(fields)) |
| 12 | |
| 13 | # Output the table contents |
| 14 | for r in records: |
| 15 | for fieldname in fields: |
| 16 | print('%10s' % getattr(r, fieldname), end=' ') |
| 17 | print() |
nothing calls this directly
no outgoing calls
no test coverage detected