Print a nicely formated table from a list of (name, shares, price, change) tuples.
(reportdata)
| 31 | return rows |
| 32 | |
| 33 | def print_report(reportdata): |
| 34 | ''' |
| 35 | Print a nicely formated table from a list of (name, shares, price, change) tuples. |
| 36 | ''' |
| 37 | headers = ('Name','Shares','Price','Change') |
| 38 | print('%10s %10s %10s %10s' % headers) |
| 39 | print(('-'*10 + ' ')*len(headers)) |
| 40 | for row in reportdata: |
| 41 | print('%10s %10d %10.2f %10.2f' % row) |
| 42 | |
| 43 | def portfolio_report(portfoliofile, pricefile): |
| 44 | ''' |