all Python 3Files & I/Oterm
csv.excel
csv — dialects
The default dialect: the CSV format Excel saves — comma, double quotes, '\r\n' line endings. It is registered under the name 'excel'.
Syntax
csv.writer(f, dialect=csv.excel) # или dialect='excel'
A Russian-locale Excel saves CSV with semicolons in cp1251, so such a file read with the excel dialect collapses into one column; you need delimiter=';' and the right encoding. The '\r\n' terminator is why blank lines appear on Windows when the file is opened without newline=''. Subclass csv.excel for your own tweaks.
Examples
import csv
print(csv.excel.delimiter, repr(csv.excel.lineterminator)) # → , '\r\n'
print(csv.get_dialect('excel').quotechar) # → "
See also
Open in the full glossarydocs.python.orgReport an inaccuracy