@@ -94,8 +94,8 @@ The :mod:`csv` module defines the following functions:
9494 :class: `Dialect ` class or one of the strings returned by the
9595 :func: `list_dialects ` function. The other optional *fmtparams * keyword arguments
9696 can be given to override individual formatting parameters in the current
97- dialect. For full details about the dialect and formatting parameters, see
98- section :ref: `csv-fmt-params `. To make it
97+ dialect. For full details about dialects and formatting parameters, see
98+ the :ref: `csv-fmt-params ` section . To make it
9999 as easy as possible to interface with modules which implement the DB API, the
100100 value :const: `None ` is written as the empty string. While this isn't a
101101 reversible transformation, it makes it easier to dump SQL NULL data values to
@@ -117,7 +117,7 @@ The :mod:`csv` module defines the following functions:
117117 Associate *dialect * with *name *. *name * must be a string. The
118118 dialect can be specified either by passing a sub-class of :class: `Dialect `, or
119119 by *fmtparams * keyword arguments, or both, with keyword arguments overriding
120- parameters of the dialect. For full details about the dialect and formatting
120+ parameters of the dialect. For full details about dialects and formatting
121121 parameters, see section :ref: `csv-fmt-params `.
122122
123123
@@ -225,9 +225,21 @@ The :mod:`csv` module defines the following classes:
225225
226226.. class :: Dialect
227227
228- The :class: `Dialect ` class is a container class relied on primarily for its
229- attributes, which are used to define the parameters for a specific
230- :class: `reader ` or :class: `writer ` instance.
228+ The :class: `Dialect ` class is a container class whose attributes contain
229+ information for how to handle doublequotes, whitespace, delimiters, etc.
230+ Due to the lack of a strict CSV specification, different applications
231+ produce subtly different CSV data. :class: `Dialect ` instances define how
232+ :class: `reader ` and :class: `writer ` instances behave.
233+
234+ All available :class: `Dialect ` names are returned by :func: `list_dialects `,
235+ and they can be registered with specific :class: `reader ` and :class: `writer `
236+ classes through their initializer (``__init__ ``) functions like this::
237+
238+ import csv
239+
240+ with open('students.csv', 'w', newline='') as csvfile:
241+ writer = csv.writer(csvfile, dialect='unix')
242+ ^^^^^^^^^^^^^^
231243
232244
233245.. class :: excel()
@@ -419,8 +431,8 @@ Reader objects (:class:`DictReader` instances and objects returned by the
419431
420432 Return the next row of the reader's iterable object as a list (if the object
421433 was returned from :func: `reader `) or a dict (if it is a :class: `DictReader `
422- instance), parsed according to the current dialect . Usually you should call
423- this as ``next(reader) ``.
434+ instance), parsed according to the current :class: ` Dialect ` . Usually you
435+ should call this as ``next(reader) ``.
424436
425437
426438Reader objects have the following public attributes:
@@ -460,9 +472,9 @@ read CSV files (assuming they support complex numbers at all).
460472
461473.. method :: csvwriter.writerow(row)
462474
463- Write the *row * parameter to the writer's file object, formatted according to
464- the current dialect . Return the return value of the call to the * write * method
465- of the underlying file object.
475+ Write the *row * parameter to the writer's file object, formatted according
476+ to the current :class: ` Dialect ` . Return the return value of the call to the
477+ * write * method of the underlying file object.
466478
467479 .. versionchanged :: 3.5
468480 Added support of arbitrary iterables.
0 commit comments