fixed lists
This commit is contained in:
parent
7c050568e2
commit
4a0299b061
67
pep-0305.txt
67
pep-0305.txt
|
@ -27,7 +27,8 @@ To Do (Notes for the Interested and Ambitious)
|
||||||
==============================================
|
==============================================
|
||||||
|
|
||||||
- Better motivation for the choice of passing a file object to the
|
- Better motivation for the choice of passing a file object to the
|
||||||
constructors. See http://manatee.mojam.com/pipermail/csv/2003-January/000179.html
|
constructors. See
|
||||||
|
http://manatee.mojam.com/pipermail/csv/2003-January/000179.html
|
||||||
|
|
||||||
- Unicode. ugh.
|
- Unicode. ugh.
|
||||||
|
|
||||||
|
@ -39,16 +40,15 @@ This PEP is about doing one thing well: parsing tabular data which may
|
||||||
use a variety of field separators, quoting characters, quote escape
|
use a variety of field separators, quoting characters, quote escape
|
||||||
mechanisms and line endings. The authors intend the proposed module
|
mechanisms and line endings. The authors intend the proposed module
|
||||||
to solve this one parsing problem efficiently. The authors do not
|
to solve this one parsing problem efficiently. The authors do not
|
||||||
intend to address any of these related topics::
|
intend to address any of these related topics:
|
||||||
|
|
||||||
- data interpretation (is a field containing the string "10"
|
- data interpretation (is a field containing the string "10" supposed
|
||||||
supposed to be a string, a float or an int? is it a number in
|
to be a string, a float or an int? is it a number in base 10, base
|
||||||
base 10, base 16 or base 2? is a number in quotes a number or a
|
16 or base 2? is a number in quotes a number or a string?)
|
||||||
string?)
|
|
||||||
|
|
||||||
- locale-specific data representation (should the number 1.23 be
|
- locale-specific data representation (should the number 1.23 be
|
||||||
written as "1.23" or "1,23" or "1 23"?) -- this may eventually
|
written as "1.23" or "1,23" or "1 23"?) -- this may eventually be
|
||||||
be addressed.
|
addressed.
|
||||||
|
|
||||||
- fixed width tabular data - can already be parsed reliably.
|
- fixed width tabular data - can already be parsed reliably.
|
||||||
|
|
||||||
|
@ -246,44 +246,42 @@ Formatting Parameters
|
||||||
|
|
||||||
In addition to the dialect argument, both the reader and writer
|
In addition to the dialect argument, both the reader and writer
|
||||||
constructors take several specific formatting parameters, specified as
|
constructors take several specific formatting parameters, specified as
|
||||||
keyword parameters. The formatting parameters understood are::
|
keyword parameters. The formatting parameters understood are:
|
||||||
|
|
||||||
- ``quotechar`` specifies a one-character string to use as the
|
- ``quotechar`` specifies a one-character string to use as the quoting
|
||||||
quoting character. It defaults to '"'. Setting this to None
|
character. It defaults to '"'. Setting this to None has the same
|
||||||
has the same effect as setting quoting to csv.QUOTE_NONE.
|
effect as setting quoting to csv.QUOTE_NONE.
|
||||||
|
|
||||||
- ``delimiter`` specifies a one-character string to use as the
|
- ``delimiter`` specifies a one-character string to use as the field
|
||||||
field separator. It defaults to ','.
|
separator. It defaults to ','.
|
||||||
|
|
||||||
- ``escapechar`` specifies a one-character string used to escape
|
- ``escapechar`` specifies a one-character string used to escape the
|
||||||
the delimiter when quotechar is set to None.
|
delimiter when quotechar is set to None.
|
||||||
|
|
||||||
- ``skipinitialspace`` specifies how to interpret whitespace which
|
- ``skipinitialspace`` specifies how to interpret whitespace which
|
||||||
immediately follows a delimiter. It defaults to False, which
|
immediately follows a delimiter. It defaults to False, which means
|
||||||
means that whitespace immediately following a delimiter is part
|
that whitespace immediately following a delimiter is part of the
|
||||||
of the following field.
|
following field.
|
||||||
|
|
||||||
- ``lineterminator`` specifies the character sequence which should
|
- ``lineterminator`` specifies the character sequence which should
|
||||||
terminate rows.
|
terminate rows.
|
||||||
|
|
||||||
- ``quoting`` controls when quotes should be generated by the
|
- ``quoting`` controls when quotes should be generated by the writer.
|
||||||
writer. It can take on any of the following module constants::
|
It can take on any of the following module constants::
|
||||||
|
|
||||||
* csv.QUOTE_MINIMAL means only when required, for example,
|
* csv.QUOTE_MINIMAL means only when required, for example, when a
|
||||||
when a field contains either the quotechar or the delimiter
|
field contains either the quotechar or the delimiter
|
||||||
|
|
||||||
* csv.QUOTE_ALL means that quotes are always placed around
|
* csv.QUOTE_ALL means that quotes are always placed around fields.
|
||||||
fields.
|
|
||||||
|
|
||||||
* csv.QUOTE_NONNUMERIC means that quotes are always placed
|
* csv.QUOTE_NONNUMERIC means that quotes are always placed around
|
||||||
around nonnumeric fields.
|
nonnumeric fields.
|
||||||
|
|
||||||
* csv.QUOTE_NONE means that quotes are never placed around
|
* csv.QUOTE_NONE means that quotes are never placed around fields.
|
||||||
fields.
|
|
||||||
|
|
||||||
- ``doublequote`` controls the handling of quotes inside fields.
|
- ``doublequote`` controls the handling of quotes inside fields. When
|
||||||
When True two consecutive quotes are interpreted as one during
|
True two consecutive quotes are interpreted as one during read, and
|
||||||
read, and when writing, each quote is written as two quotes.
|
when writing, each quote is written as two quotes.
|
||||||
|
|
||||||
When processing a dialect setting and one or more of the other
|
When processing a dialect setting and one or more of the other
|
||||||
optional parameters, the dialect parameter is processed before the
|
optional parameters, the dialect parameter is processed before the
|
||||||
|
@ -330,7 +328,6 @@ Testing
|
||||||
The sample implementation [1]_ includes a set of test cases.
|
The sample implementation [1]_ includes a set of test cases.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Issues
|
Issues
|
||||||
======
|
======
|
||||||
|
|
||||||
|
@ -376,10 +373,10 @@ Issues
|
||||||
dicts by the writer? See the DictReader and DictWriter classes in
|
dicts by the writer? See the DictReader and DictWriter classes in
|
||||||
csv.py.
|
csv.py.
|
||||||
|
|
||||||
8. Are quote character and delimiters limited to single characters?
|
7. Are quote character and delimiters limited to single characters?
|
||||||
For the time being, yes.
|
For the time being, yes.
|
||||||
|
|
||||||
9. How should rows of different lengths be handled? Interpretation of
|
8. How should rows of different lengths be handled? Interpretation of
|
||||||
the data is the application's job. There is no such thing as a
|
the data is the application's job. There is no such thing as a
|
||||||
"short row" or a "long row" at this level.
|
"short row" or a "long row" at this level.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue