[Csv] Made some changes to the PEP
Dave Cole
djc at object-craft.com.au
Thu Jan 30 14:30:10 CET 2003
>>>>> "Skip" == Skip Montanaro <skip at pobox.com> writes:
Dave> Here is the commit message:
Dave> Trying to bring PEP up to date with discussions on mailing
Dave> list...
Skip> Much appreciated. I just added a todo section near the top.
Skip> Anyone can feel free to add to the list or take care of any
Skip> items.
>From the TODO:
- Need to complete initial list of formatting parameters and settle on
names.
This is what I have done in the _csv module:
>>> import _csv
>>> help(_csv)
[snip]
delimiter
Defines the character that will be used to separate
fields in the CSV record.
quotechar
Defines the character used to quote fields that
contain the field separator or newlines. If set to None
special characters will be escaped using the escapechar.
escapechar
Defines the character used to escape special
characters. Only used if quotechar is None.
doublequote
When True, quotes in a fields must be doubled up.
skipinitialspace
When True spaces following the delimiter are ignored.
lineterminator
The string used to terminate records.
quoting
Controls the generation of quotes around fields when writing
records. This is only used when quotechar is not None.
autoclear
When True, calling parse() will automatically call
the clear() method if the previous call to parse() raised an
exception during parsing.
strict
When True, the parser will raise an exception on
malformed fields rather than attempting to guess the right
behavior.
[snip]
Not sure that we need to keep the last two...
When the parser fails you are able to look at the fields it managed to
parse before the problem was encountered. This might be useful for
the sniffer. The autoclear parameter controls whether or not you must
manually clear() the partial record before trying to parse more data.
The strict parameter controls what happens when you see data like
this:
"blah","oops" blah"
If strict is False then the " after the oops is included as part of
the field 'oops" blah'. If in strict is True and exception is raised.
- Dave
--
http://www.object-craft.com.au
More information about the Csv
mailing list