MCPcopy Index your code
hub / github.com/dabeaz-course/practical-python / read_portfolio

Function read_portfolio

Solutions/8_1/report.py:8–14  ·  view source on GitHub ↗

Read a stock portfolio file into a list of dictionaries with keys name, shares, and price.

(filename, **opts)

Source from the content-addressed store, hash-verified

6import tableformat
7
8def read_portfolio(filename, **opts):
9 '''
10 Read a stock portfolio file into a list of dictionaries with keys
11 name, shares, and price.
12 '''
13 with open(filename) as lines:
14 return Portfolio.from_csv(lines, **opts)
15
16def read_prices(filename, **opts):
17 '''

Callers 1

portfolio_reportFunction · 0.70

Calls 1

from_csvMethod · 0.45

Tested by

no test coverage detected