Exercise 4.2 - Solution

(d) Command Line Options

# report.py
...

def main():
    import sys
    if len(sys.argv) != 3:
        raise SystemExit('Usage: %s portfile pricefile' % sys.argv[0])
    portfolio_report(sys.argv[1], sys.argv[2])

if __name__ == '__main__':
    main()

[ Back ]