1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Databases in Python

Connected

Exercise

Reading the data from the CSV

Leverage the Python CSV module from the standard library and load the data into a list of dictionaries.

It may help to refer back to the Chapter 4 exercise in which you did something similar.

Instructions

100 XP
  • Create an empty list called values_list.
  • Iterate over the rows of csv_reader with a for loop, creating a dictionary called data for each row and append it to values_list.
    • Within the for loop, row will be a list whose entries are 'state' , 'sex', 'age', 'pop2000' and 'pop2008' (in that order).