I have recently learnt how to read CSV files using Python 3, and have been playing around with my code and have managed to read either the whole document or certain columns. Now I am trying to read only certain records that contain a certain value.
For example I want to read all records where the car is blue, how would I make it read only those records?
import csv
with open('cars.csv') as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
print(row['ID'], row['Make'], row['Colour'])