csv module strangeness.

tobiah st at tobiah.org
Wed Aug 30 17:17:27 EDT 2006


> you may be misreading the docs; the Dialect has no values at all, and 
> must be subclassed (and the subclass must provide settings). 

The docs clearly state what the defaults are, but they are not
in the code.  It seems so clumsy to have to specify every one 
of these, just to change the delimiter from comma to tab.

http://docs.python.org/lib/csv-fmt-params.html : 

delimiter
    A one-character string used to separate fields. It defaults to ','. 

doublequote
    Controls how instances of quotechar appearing inside a field should be themselves be quoted. When True, the character is doubled. When False, the escapechar must be a one-character string which is used as a prefix to the quotechar. It defaults to True. 

escapechar
    A one-character string used to escape the delimiter if quoting is set to QUOTE_NONE. It defaults to None. 

lineterminator
    The string used to terminate lines in the CSV file. It defaults to '\r\n'. 

quotechar
    A one-character string used to quote elements containing the delimiter or which start with the quotechar. It defaults to '"'. 

quoting
    Controls when quotes should be generated by the writer. It can take on any of the QUOTE_* constants (see section 12.20.1) and defaults to QUOTE_MINIMAL. 

skipinitialspace
    When True, whitespace immediately following the delimiter is ignored. The default is False. 

-- 
Posted via a free Usenet account from http://www.teranews.com




More information about the Python-list mailing list