[Python-ideas] csv dialect enhancement

Ethan Furman ethan at stoneleaf.us
Fri Jan 11 18:49:27 CET 2013


On 01/11/2013 09:16 AM, rurpy at yahoo.com wrote:
> I propose that a new dialect attribute be added, "nulls",
> which when false (default) will cause csv to behave as it currently
> does.  When true it will have the following effect:
>
> Reader:
>    When two adjacent delimiters occur, or two white-space
>    separated delimiters when Dialect.skipinitialspace is true,
>    a value of None will be returned for that field.
>
> Writer:
>    When a None is present in the the list of items being
>    formatted, it will result in an empty output field
>    (two adjacent delimiters) regardless of other options
>    (eg a QUOTE_ALL setting.)
>
> Sniffer:
>    Will set "nulls" to True when both adjacent delimiters and
>    quoted empty strings are seen in the input text.
>    (Perhaps this behaviour needs to be optional for backward
>    compatibility reasons?)

+1



More information about the Python-ideas mailing list