Snatch any course you want for just $15! Go to “Courses” and find a course ↓
Introduction
CSV dialects
5. Dialects for CSV reading
Summary

Instruction

Good job! It's time to see how we can use a dialect when reading a CSV file. Take a look:

import csv
with open('animals.csv') as csv_file:
  csv_reader = csv.reader(csv_file, dialect='unix')
  for row in csv_reader:
    print(row)

The only thing you need to do is specify the optional dialect parameter when invoking csv.reader() or csv.DictReader(). You can see how easy it is to use dialects now!

Exercise

Open the budget.csv file. Print each row on a new line as shown in the explanation. Use the excel-tab dialect.

Stuck? Here's a hint!

Use the following optional parameter: dialect='excel-tab'.