diff options
author | Georg Brandl <georg@python.org> | 2010-10-27 07:27:06 +0000 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2010-10-27 07:27:06 +0000 |
commit | e9bdcbcc2e7d40f8d6fd3841c89577b301bd8571 (patch) | |
tree | 8c47b9e155d7540909c8c349b858a601576d9477 /Lib/csv.py | |
parent | d2a87c9b291d8570d76bc21c4e5e5a97dfc6f40c (diff) | |
download | cpython-e9bdcbcc2e7d40f8d6fd3841c89577b301bd8571.tar.gz |
#5975: add unix_dialect to csv module.
Diffstat (limited to 'Lib/csv.py')
-rw-r--r-- | Lib/csv.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/Lib/csv.py b/Lib/csv.py index 5ae5a73046..e0f47e8b5d 100644 --- a/Lib/csv.py +++ b/Lib/csv.py @@ -20,7 +20,7 @@ __all__ = [ "QUOTE_MINIMAL", "QUOTE_ALL", "QUOTE_NONNUMERIC", "QUOTE_NONE", "unregister_dialect", "__version__", "DictReader", "DictWriter" ] class Dialect: - """Describe an Excel dialect. + """Describe a CSV dialect. This must be subclassed (see csv.excel). Valid attributes are: delimiter, quotechar, escapechar, doublequote, skipinitialspace, @@ -65,6 +65,16 @@ class excel_tab(excel): delimiter = '\t' register_dialect("excel-tab", excel_tab) +class unix_dialect(Dialect): + """Describe the usual properties of Unix-generated CSV files.""" + delimiter = ',' + quotechar = '"' + doublequote = True + skipinitialspace = False + lineterminator = '\n' + quoting = QUOTE_ALL +register_dialect("unix", unix_dialect) + class DictReader: def __init__(self, f, fieldnames=None, restkey=None, restval=None, |