Print a nicely formated table from a list of (name, shares, price, change) tuples.
(reportdata)
| 51 | return rows |
| 52 | |
| 53 | def print_report(reportdata): |
| 54 | ''' |
| 55 | Print a nicely formated table from a list of (name, shares, price, change) tuples. |
| 56 | ''' |
| 57 | headers = ('Name','Shares','Price','Change') |
| 58 | print('%10s %10s %10s %10s' % headers) |
| 59 | print(('-'*10 + ' ')*len(headers)) |
| 60 | for row in reportdata: |
| 61 | print('%10s %10d %10.2f %10.2f' % row) |
| 62 | |
| 63 | def portfolio_report(portfoliofile,pricefile): |
| 64 | ''' |