On this page
csv.unix_dialect
Prev: csv.Sniffer | Up: csv | Next: csv.unregister_dialect
Rel: csv.Dialect, csv.DictReader, csv.DictWriter, csv.Error
Ref: docs.python.org — csv.unix_dialect
Tags: #public #python3 #stdlib #csv
Import
import csv
from csv import unix_dialect
Signature & Overview
csv.unix_dialect()
Describe the usual properties of Unix-generated CSV files.
Usage
import csv
import io
buf = io.StringIO()
csv.writer(buf, dialect=csv.unix_dialect).writerow(["a", 1])
assert buf.getvalue() == '"a","1"\n'
Gotchas
- Quotes every field (
QUOTE_ALL) and uses\n: Unlikeexcel(QUOTE_MINIMAL,\r\n),unix_dialectwraps all values in double quotes.
REPL Inspect
from csv import unix_dialect
help(unix_dialect)
Linked from
Related notes
- tuts/python3/stdlib_module/csv/Sniffer Linked here; links to this page; shared tags: #csv, #stdlib
- tuts/python3/stdlib_module/csv/unregister_dialect Linked here; links to this page; shared tags: #csv, #stdlib
- tuts/python3/stdlib_module/csv Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/csv/Dialect Linked here; shared tags: #csv, #stdlib
- tuts/python3/stdlib_module/csv/DictReader Linked here; shared tags: #csv, #stdlib
- tuts/python3/stdlib_module/csv/DictWriter Linked here; shared tags: #csv, #stdlib
- tuts/python3/stdlib_module/csv/Error Linked here; shared tags: #csv, #stdlib
- tuts/python3/stdlib_module/csv/excel shared tags: #csv, #stdlib
- tuts/python3/stdlib_module/csv/excel_tab shared tags: #csv, #stdlib
- tuts/python3/stdlib_module/csv/field_size_limit shared tags: #csv, #stdlib