diff options
author | Skip Montanaro <skip.montanaro@gmail.com> | 2024-01-31 09:32:12 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-31 09:32:12 (GMT) |
commit | a38bc7cad613b604671764d893873d291269c61f (patch) | |
tree | 9ebc722d0d837d7fe78754083e5c4ff480cd9bc6 | |
parent | 48632d22d6450734850ad821f56ce5e52e67db21 (diff) | |
download | cpython-a38bc7cad613b604671764d893873d291269c61f.zip cpython-a38bc7cad613b604671764d893873d291269c61f.tar.gz cpython-a38bc7cad613b604671764d893873d291269c61f.tar.bz2 |
[3.11] gh-101100: Fix references in csv docs (GH-114658) (GH-114773)
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
(cherry picked from commit 3911b42cc0d404e0eac87fce30b740b08618ff06)
-rw-r--r-- | Doc/library/csv.rst | 14 | ||||
-rw-r--r-- | Doc/tools/.nitignore | 1 |
2 files changed, 7 insertions, 8 deletions
diff --git a/Doc/library/csv.rst b/Doc/library/csv.rst index 8004d66..e82c7de 100644 --- a/Doc/library/csv.rst +++ b/Doc/library/csv.rst @@ -88,7 +88,7 @@ The :mod:`csv` module defines the following functions: Return a writer object responsible for converting the user's data into delimited strings on the given file-like object. *csvfile* can be any object with a - :func:`write` method. If *csvfile* is a file object, it should be opened with + :meth:`~io.TextIOBase.write` method. If *csvfile* is a file object, it should be opened with ``newline=''`` [1]_. An optional *dialect* parameter can be given which is used to define a set of parameters specific to a particular CSV dialect. It may be an instance of a subclass of the @@ -195,10 +195,10 @@ The :mod:`csv` module defines the following classes: Create an object which operates like a regular writer but maps dictionaries onto output rows. The *fieldnames* parameter is a :mod:`sequence <collections.abc>` of keys that identify the order in which values in the - dictionary passed to the :meth:`writerow` method are written to file + dictionary passed to the :meth:`~csvwriter.writerow` method are written to file *f*. The optional *restval* parameter specifies the value to be written if the dictionary is missing a key in *fieldnames*. If the - dictionary passed to the :meth:`writerow` method contains a key not found in + dictionary passed to the :meth:`~csvwriter.writerow` method contains a key not found in *fieldnames*, the optional *extrasaction* parameter indicates what action to take. If it is set to ``'raise'``, the default value, a :exc:`ValueError` @@ -352,8 +352,8 @@ Dialects and Formatting Parameters To make it easier to specify the format of input and output records, specific formatting parameters are grouped together into dialects. A dialect is a -subclass of the :class:`Dialect` class having a set of specific methods and a -single :meth:`validate` method. When creating :class:`reader` or +subclass of the :class:`Dialect` class containing various attributes +describing the format of the CSV file. When creating :class:`reader` or :class:`writer` objects, the programmer can specify a string or a subclass of the :class:`Dialect` class as the dialect parameter. In addition to, or instead of, the *dialect* parameter, the programmer can also specify individual @@ -470,9 +470,9 @@ DictReader objects have the following public attribute: Writer Objects -------------- -:class:`Writer` objects (:class:`DictWriter` instances and objects returned by +:class:`writer` objects (:class:`DictWriter` instances and objects returned by the :func:`writer` function) have the following public methods. A *row* must be -an iterable of strings or numbers for :class:`Writer` objects and a dictionary +an iterable of strings or numbers for :class:`writer` objects and a dictionary mapping fieldnames to strings or numbers (by passing them through :func:`str` first) for :class:`DictWriter` objects. Note that complex numbers are written out surrounded by parens. This may cause some problems for other programs which diff --git a/Doc/tools/.nitignore b/Doc/tools/.nitignore index 266f1c7..c2f8007 100644 --- a/Doc/tools/.nitignore +++ b/Doc/tools/.nitignore @@ -27,7 +27,6 @@ Doc/library/asyncio-subprocess.rst Doc/library/bdb.rst Doc/library/collections.rst Doc/library/copy.rst -Doc/library/csv.rst Doc/library/ctypes.rst Doc/library/dbm.rst Doc/library/decimal.rst |