MCPcopy Create free account
hub / github.com/dabeaz-course/practical-python / read_portfolio

Function read_portfolio

Solutions/3_16/report.py:5–10  ·  view source on GitHub ↗

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

(filename)

Source from the content-addressed store, hash-verified

3import fileparse
4
5def read_portfolio(filename):
6 '''
7 Read a stock portfolio file into a list of dictionaries with keys
8 name, shares, and price.
9 '''
10 return fileparse.parse_csv(filename, select=['name','shares','price'], types=[str,int,float])
11
12def read_prices(filename):
13 '''

Callers 1

portfolio_reportFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected