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
|
||||
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.
|
||||
|
||||
|
@ -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
|
||||
mechanisms and line endings. The authors intend the proposed module
|
||||
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"
|
||||
supposed to be a string, a float or an int? is it a number in
|
||||
base 10, base 16 or base 2? is a number in quotes a number or a
|
||||
string?)
|
||||
- data interpretation (is a field containing the string "10" supposed
|
||||
to be a string, a float or an int? is it a number in base 10, base
|
||||
16 or base 2? is a number in quotes a number or a string?)
|
||||
|
||||
- locale-specific data representation (should the number 1.23 be
|
||||
written as "1.23" or "1,23" or "1 23"?) -- this may eventually
|
||||
be addressed.
|
||||
written as "1.23" or "1,23" or "1 23"?) -- this may eventually be
|
||||
addressed.
|
||||
|
||||
- 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
|
||||
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
|
||||
quoting character. It defaults to '"'. Setting this to None
|
||||
has the same effect as setting quoting to csv.QUOTE_NONE.
|
||||
- ``quotechar`` specifies a one-character string to use as the quoting
|
||||
character. It defaults to '"'. Setting this to None has the same
|
||||
effect as setting quoting to csv.QUOTE_NONE.
|
||||
|
||||
- ``delimiter`` specifies a one-character string to use as the
|
||||
field separator. It defaults to ','.
|
||||
- ``delimiter`` specifies a one-character string to use as the field
|
||||
separator. It defaults to ','.
|
||||
|
||||
- ``escapechar`` specifies a one-character string used to escape
|
||||
the delimiter when quotechar is set to None.
|
||||
- ``escapechar`` specifies a one-character string used to escape the
|
||||
delimiter when quotechar is set to None.
|
||||
|
||||
- ``skipinitialspace`` specifies how to interpret whitespace which
|
||||
immediately follows a delimiter. It defaults to False, which
|
||||
means that whitespace immediately following a delimiter is part
|
||||
of the following field.
|
||||
immediately follows a delimiter. It defaults to False, which means
|
||||
that whitespace immediately following a delimiter is part of the
|
||||
following field.
|
||||
|
||||
- ``lineterminator`` specifies the character sequence which should
|
||||
terminate rows.
|
||||
|
||||
- ``quoting`` controls when quotes should be generated by the
|
||||
writer. It can take on any of the following module constants::
|
||||
- ``quoting`` controls when quotes should be generated by the writer.
|
||||
It can take on any of the following module constants::
|
||||
|
||||
* csv.QUOTE_MINIMAL means only when required, for example,
|
||||
when a field contains either the quotechar or the delimiter
|
||||
* csv.QUOTE_MINIMAL means only when required, for example, when a
|
||||
field contains either the quotechar or the delimiter
|
||||
|
||||
* csv.QUOTE_ALL means that quotes are always placed around
|
||||
fields.
|
||||
* csv.QUOTE_ALL means that quotes are always placed around fields.
|
||||
|
||||
* csv.QUOTE_NONNUMERIC means that quotes are always placed
|
||||
around nonnumeric fields.
|
||||
* csv.QUOTE_NONNUMERIC means that quotes are always placed around
|
||||
nonnumeric fields.
|
||||
|
||||
* csv.QUOTE_NONE means that quotes are never placed around
|
||||
fields.
|
||||
* csv.QUOTE_NONE means that quotes are never placed around fields.
|
||||
|
||||
- ``doublequote`` controls the handling of quotes inside fields.
|
||||
When True two consecutive quotes are interpreted as one during
|
||||
read, and when writing, each quote is written as two quotes.
|
||||
- ``doublequote`` controls the handling of quotes inside fields. When
|
||||
True two consecutive quotes are interpreted as one during read, and
|
||||
when writing, each quote is written as two quotes.
|
||||
|
||||
When processing a dialect setting and one or more of the other
|
||||
optional parameters, the dialect parameter is processed before the
|
||||
|
@ -330,7 +328,6 @@ Testing
|
|||
The sample implementation [1]_ includes a set of test cases.
|
||||
|
||||
|
||||
|
||||
Issues
|
||||
======
|
||||
|
||||
|
@ -376,10 +373,10 @@ Issues
|
|||
dicts by the writer? See the DictReader and DictWriter classes in
|
||||
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.
|
||||
|
||||
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
|
||||
"short row" or a "long row" at this level.
|
||||
|
||||
|
|
Loading…
Reference in New Issue