Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions Doc/library/csv.rst
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,8 @@ The :mod:`!csv` module defines the following classes:

If several combinations fit the sample equally well ---
for example if both ``','`` and ``';'`` split every row consistently ---
the delimiters ``','``, ``'\t'``, ``';'``, ``' '`` and ``':'``
are preferred, in this order,
the delimiters listed in the :attr:`~Sniffer.preferred` attribute
are preferred, in that order,
no matter how many times each of them occurs.

.. versionchanged:: next
Expand Down Expand Up @@ -354,6 +354,15 @@ The :mod:`!csv` module defines the following classes:
This method is a rough heuristic and may produce both false positives and
negatives.

The :class:`Sniffer` class has the following attribute:

.. attribute:: preferred

The list of the delimiters preferred for breaking ties,
in the order of preference.
It can be modified.
Its initial value is ``[',', '\t', ';', ' ', ':']``.

An example for :class:`Sniffer` use::

with open('example.csv', newline='') as csvfile:
Expand Down
Loading