Lesson 3 of 7
CSV: read with DictReader
csv.DictReader turns each row into a dictionary whose keys come from the header — more readable than numeric indexes.
Careful: every value read is a string. Converting to numbers is on you.
import csv, io rows = list(csv.DictReader(io.StringIO(data))) print(rows[0]["product"])
🎯 Exercise
Read DATA with csv.DictReader and collect all rows into the rows list (use list()). Print the number of rows.
PRO lesson
This advanced chapter is part of CodeAge PRO. Unlock it to keep your adventure going.
Discover PRO →