Python: Read a CSV file
A short, tested Python example for read a csv file. Copy it and adjust the names and paths for your project.
Python
import csv
with open("data.csv", newline="", encoding="utf-8") as f:
for row in csv.DictReader(f):
print(row["name"], row["age"])Find it in Zest
Search for “python read a csv file” in Zest and this example appears above the results, with other matches to choose from. Searches stay private.