Python 3.2+Files & I/Oterm
csv.unix_dialect
csv — dialects
A Unix-style dialect: '\n' line endings and quotes around every field. It is registered under the name 'unix'.
Syntax
csv.writer(f, dialect='unix')
People pick it for '\n' instead of '\r\n', but it also turns on QUOTE_ALL: every field is quoted, numbers included, so the file looks noticeably different. If you only want a different line ending, pass lineterminator='\n' to the writer. For reading the difference does not matter: reader accepts both line endings.
Examples
import csv
import io
out = io.StringIO()
csv.writer(out, dialect='unix').writerow(['a', 1])
print(repr(out.getvalue())) # → '"a","1"\n'
See also
Open in the full glossarydocs.python.orgReport an inaccuracy