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