diff options
Diffstat (limited to 'Doc/library/csv.rst')
-rw-r--r-- | Doc/library/csv.rst | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/Doc/library/csv.rst b/Doc/library/csv.rst index bcda1bd..678d4d7 100644 --- a/Doc/library/csv.rst +++ b/Doc/library/csv.rst @@ -43,8 +43,6 @@ using the :class:`DictReader` and :class:`DictWriter` classes. .. seealso:: - .. % \seemodule{array}{Arrays of uniformly types numeric values.} - :pep:`305` - CSV File API The Python Enhancement Proposal which proposed this addition to Python. @@ -83,6 +81,15 @@ The :mod:`csv` module defines the following functions: consequence, if newlines embedded within fields are important, the input should be split into lines in a manner which preserves the newline characters. + A short usage example:: + + >>> import csv + >>> spamReader = csv.reader(open('eggs.csv'), delimiter=' ', quotechar='|') + >>> for row in spamReader: + ... print ', '.join(row) + Spam, Spam, Spam, Spam, Spam, Baked Beans + Spam, Lovely Spam, Wonderful Spam + .. function:: writer(csvfile[, dialect='excel'][, fmtparam]) @@ -103,6 +110,14 @@ The :mod:`csv` module defines the following functions: CSV files without preprocessing the data returned from a ``cursor.fetch*`` call. All other non-string data are stringified with :func:`str` before being written. + A short usage example:: + + >>> import csv + >>> spamWriter = csv.writer(open('eggs.csv', 'w'), delimiter=' ', + ... quotechar='|', quoting=QUOTE_MINIMAL) + >>> spamWriter.writerow(['Spam'] * 5 + ['Baked Beans']) + >>> spamWriter.writerow(['Spam', 'Lovely Spam', 'Wonderful Spam']) + .. function:: register_dialect(name[, dialect][, fmtparam]) |