Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
CSV dialects
Summary
9. Summary

Instruction

All right, it's time to wrap things up!

  1. A CSV dialect is just a list of parameters that specify a specific CSV file format.
  2. For each dialect, you can set the following options:
    • delimiter
    • quotechar
    • doublequote
    • escapechar
    • lineterminator
    • quoting
    • skipinitialspace
  3. To use a given dialect, provide its name as the dialect parameter. For instance:
    csv_reader = csv.reader(csv_file, dialect='unix')
  4. To create a new dialect, use:
    csv.register_dialect('dialect_name', parameter1='value1', parameter2='value2'...)
    To check its properties later on, use:
    csv.get_dialect('dialect_name')
    And be sure to add the property of your choice at the end. For example:
    csv.get_dialect('dialect_name').delimiter
  5. To list all available dialects, use: csv.list_dialects()

Great! Ready for a quick task?

Exercise

Click Next exercise to continue.