Python Glossary Русский

all Python 3Files & I/Ofunction

csv.list_dialects()

csv — dialects

Returns the names of all registered dialects: the built-in 'excel', 'excel-tab', 'unix' and any added with register_dialect().

Syntax

csv.list_dialects()

The list shows registration names, not class names: it says 'excel-tab' with a hyphen, although the class is csv.excel_tab. It is a snapshot at call time: the registry is process-wide, and another module may have added or removed a dialect. Handy as a check before get_dialect(), which raises csv.Error on an unknown name.

Examples

import csv
print(sorted(csv.list_dialects()))  # → ['excel', 'excel-tab', 'unix']

See also

Open in the full glossarydocs.python.orgReport an inaccuracy