Exercise: List of dictionaries
Given the following file build a list of dictionaries where each dictionary represents one person. The keys in the dictionary are the names of the columns (fname, lname, born) the values are the respective values from each row. Create a file called list_of_dictionaries.py.
examples/csv/monty_python.csv
fname,lname,born Graham,Chapman,8 January 1941 Eric,Idle,29 March 1943 Terry,Gilliam,22 November 1940 Terry,Jones,1 February 1942 John,Cleese,27 October 1939 Michael,Palin,5 May 1943
- Skeleton
examples/dictionary/list_of_dictionaries_skeleton.py
# ... print(people[1]['fname'])