Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f031a6f

Browse files
committed
#20628: wrap lines to < 80.
1 parent df714b9 commit f031a6f

1 file changed

Lines changed: 37 additions & 34 deletions

File tree

Doc/library/csv.rst

Lines changed: 37 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -142,40 +142,43 @@ The :mod:`csv` module defines the following functions:
142142

143143
The :mod:`csv` module defines the following classes:
144144

145-
.. class:: DictReader(csvfile, fieldnames=None, restkey=None, restval=None, dialect='excel', *args, **kwds)
146-
147-
Create an object which operates like a regular reader but maps the information
148-
read into a dict whose keys are given by the optional *fieldnames* parameter.
149-
The *fieldnames* parameter is a :mod:`sequence <collections.abc>` whose elements
150-
are associated with the fields of the input data in order. These elements
151-
become the keys of the resulting dictionary.
152-
If the *fieldnames* parameter is omitted, the values in the first row of the
153-
*csvfile* will be used as the fieldnames. If the row read has more fields
154-
than the fieldnames sequence, the remaining data is added as a sequence
155-
keyed by the value of *restkey*. If the row read has fewer fields than the
156-
fieldnames sequence, the remaining keys take the value of the optional
157-
*restval* parameter. Any other optional or keyword arguments are passed to
158-
the underlying :class:`reader` instance.
159-
160-
161-
.. class:: DictWriter(csvfile, fieldnames, restval='', extrasaction='raise', dialect='excel', *args, **kwds)
162-
163-
Create an object which operates like a regular writer but maps dictionaries onto
164-
output rows. The *fieldnames* parameter is a :mod:`sequence
165-
<collections.abc>` of keys that identify the order in which values in
166-
the dictionary passed to the :meth:`writerow` method are written to the
167-
*csvfile*. The optional *restval* parameter specifies the value to be written
168-
if the dictionary is missing a key in *fieldnames*. If the dictionary passed to
169-
the :meth:`writerow` method contains a key not found in *fieldnames*, the
170-
optional *extrasaction* parameter indicates what action to take. If it is set
171-
to ``'raise'`` a :exc:`ValueError` is raised. If it is set to ``'ignore'``,
172-
extra values in the dictionary are ignored. Any other optional or keyword
173-
arguments are passed to the underlying :class:`writer` instance.
174-
175-
Note that unlike the :class:`DictReader` class, the *fieldnames* parameter of
176-
the :class:`DictWriter` is not optional. Since Python's :class:`dict` objects
177-
are not ordered, there is not enough information available to deduce the order
178-
in which the row should be written to the *csvfile*.
145+
.. class:: DictReader(csvfile, fieldnames=None, restkey=None, restval=None, \
146+
dialect='excel', *args, **kwds)
147+
148+
Create an object which operates like a regular reader but maps the
149+
information read into a dict whose keys are given by the optional
150+
*fieldnames* parameter. The *fieldnames* parameter is a :mod:`sequence
151+
<collections.abc>` whose elements are associated with the fields of the
152+
input data in order. These elements become the keys of the resulting
153+
dictionary. If the *fieldnames* parameter is omitted, the values in the
154+
first row of the *csvfile* will be used as the fieldnames. If the row read
155+
has more fields than the fieldnames sequence, the remaining data is added as
156+
a sequence keyed by the value of *restkey*. If the row read has fewer
157+
fields than the fieldnames sequence, the remaining keys take the value of
158+
the optional *restval* parameter. Any other optional or keyword arguments
159+
are passed to the underlying :class:`reader` instance.
160+
161+
162+
.. class:: DictWriter(csvfile, fieldnames, restval='', extrasaction='raise', \
163+
dialect='excel', *args, **kwds)
164+
165+
Create an object which operates like a regular writer but maps dictionaries
166+
onto output rows. The *fieldnames* parameter is a :mod:`sequence
167+
<collections.abc>` of keys that identify the order in which values in the
168+
dictionary passed to the :meth:`writerow` method are written to the
169+
*csvfile*. The optional *restval* parameter specifies the value to be
170+
written if the dictionary is missing a key in *fieldnames*. If the
171+
dictionary passed to the :meth:`writerow` method contains a key not found in
172+
*fieldnames*, the optional *extrasaction* parameter indicates what action to
173+
take. If it is set to ``'raise'`` a :exc:`ValueError` is raised. If it is
174+
set to ``'ignore'``, extra values in the dictionary are ignored. Any other
175+
optional or keyword arguments are passed to the underlying :class:`writer`
176+
instance.
177+
178+
Note that unlike the :class:`DictReader` class, the *fieldnames* parameter
179+
of the :class:`DictWriter` is not optional. Since Python's :class:`dict`
180+
objects are not ordered, there is not enough information available to deduce
181+
the order in which the row should be written to the *csvfile*.
179182

180183

181184
.. class:: Dialect

0 commit comments

Comments
 (0)