Skip to content
Open
Show file tree
Hide file tree
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
16 changes: 16 additions & 0 deletions Doc/library/csv.rst
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,22 @@ The :mod:`!csv` module defines the following classes:
is given, it is interpreted as a string containing possible valid
delimiter characters.

The dialect is deduced by parsing the sample with every plausible
combination of parameters
and choosing the combination which splits the sample into rows
with the most consistent number of fields,
so the returned dialect is consistent with how :func:`reader`
will parse the sample.
Raise :exc:`Error` if no combination fits the sample,
in particular if it is a single column,
so there is no delimiter to find.

.. versionchanged:: next
The dialect is now deduced by trial parsing
and the results may differ from those of earlier Python versions.
The *escapechar* parameter can now be detected,
and the requested *delimiters* are not restricted to ASCII.


.. method:: has_header(sample)

Expand Down
15 changes: 15 additions & 0 deletions Doc/whatsnew/3.16.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,21 @@ codecs
even when a built-in codec of the same name exists.
(Contributed by Serhiy Storchaka in :gh:`152997`.)

csv
---

* :meth:`csv.Sniffer.sniff` now deduces the dialect by trial parsing
instead of heuristics based on matching isolated fragments
and on character frequencies,
so the result is consistent with how :func:`csv.reader` will parse the sample.
It can now detect the *escapechar* parameter,
accepts non-ASCII delimiters in the *delimiters* argument,
no longer misdetects the delimiter
when the sample contains delimiter characters inside quoted fields,
and no longer takes quadratic time on quoted samples.
The results may differ from those of earlier Python versions.
(Contributed by Serhiy Storchaka in :gh:`83273`.)

curses
------

Expand Down
Loading
Loading