ASPN ActiveState Programmer Network
  ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups | Web Services
SEARCH
advanced | search help

Reference
ActivePython 2.4
Python Documentation
Library Reference
12. Internet Data Handling
12.1 formatter -- Generic output formatting
12.2 email -- An email and MIME handling package
12.3 mailcap -- Mailcap file handling.
12.4 mailbox -- Read various mailbox formats
12.5 mhlib -- Access to MH mailboxes
12.6 mimetools -- Tools for parsing MIME messages
12.7 mimetypes -- Map filenames to MIME types
12.8 MimeWriter -- Generic MIME file writer
12.9 mimify -- MIME processing of mail messages
12.10 multifile -- Support for files containing distinct parts
12.11 rfc822 -- Parse RFC 2822 mail headers
12.12 base64 -- RFC 3548: Base16, Base32, Base64 Data Encodings
12.13 binascii -- Convert between binary and ASCII
12.14 binhex -- Encode and decode binhex4 files
12.15 quopri -- Encode and decode MIME quoted-printable data
12.16 uu -- Encode and decode uuencode files
12.17 xdrlib -- Encode and decode XDR data
12.18 netrc -- netrc file processing
12.19 robotparser -- Parser for robots.txt
12.20 csv -- CSV File Reading and Writing
12.20.1 Module Contents
12.20.2 Dialects and Formatting Parameters
12.20.3 Reader Objects
12.20.4 Writer Objects
12.20.5 Examples

MyASPN >> Reference >> ActivePython 2.4 >> Python Documentation >> Library Reference >> 12. Internet Data Handling
ActivePython 2.4 documentation

12.20 csv -- CSV File Reading and Writing

New in version 2.3.

The so-called CSV (Comma Separated Values) format is the most common import and export format for spreadsheets and databases. There is no ``CSV standard'', so the format is operationally defined by the many applications which read and write it. The lack of a standard means that subtle differences often exist in the data produced and consumed by different applications. These differences can make it annoying to process CSV files from multiple sources. Still, while the delimiters and quoting characters vary, the overall format is similar enough that it is possible to write a single module which can efficiently manipulate such data, hiding the details of reading and writing the data from the programmer.

The csv module implements classes to read and write tabular data in CSV format. It allows programmers to say, ``write this data in the format preferred by Excel,'' or ``read data from this file which was generated by Excel,'' without knowing the precise details of the CSV format used by Excel. Programmers can also describe the CSV formats understood by other applications or define their own special-purpose CSV formats.

The csv module's reader and writer objects read and write sequences. Programmers can also read and write data in dictionary form using the DictReader and DictWriter classes.

Note: This version of the csv module doesn't support Unicode input. Also, there are currently some issues regarding ASCII NUL characters. Accordingly, all input should generally be printable ASCII to be safe. These restrictions will be removed in the future.

See Also:

PEP 305, CSV File API
The Python Enhancement Proposal which proposed this addition to Python.



See About this document... for information on suggesting changes.

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState 2004 All rights reserved