15 lines
315 B
Python
15 lines
315 B
Python
# Prints all favorites in CSV using csv.DictReader
|
|
|
|
import csv
|
|
|
|
# Open CSV file
|
|
with open("favorites.csv", "r") as file:
|
|
|
|
# Create DictReader
|
|
reader = csv.DictReader(file)
|
|
|
|
# Iterate over CSV file, printing each favorite
|
|
for row in reader:
|
|
favorite = row["language"]
|
|
print(favorite)
|