CSV reader and writer#
Agate contains CSV readers and writers that are intended to be used as a drop-in replacement for csv
. These versions add unicode support for Python 2 and several other minor features.
Agate methods will use these version automatically. If you would like to use them in your own code, you can import them, like this:
from agate import csv
Due to nuanced differences between the versions, these classes are implemented seperately for Python 2 and Python 3. The documentation for both versions is provided below, but only the one for your version of Python is imported with the above code.
Python 3#
A replacement for Python's |
|
A replacement for Python's |
|
A wrapper around Python 3's builtin |
|
A wrapper around Python 3's builtin |
|
A wrapper around Python 3's builtin |
|
A wrapper around Python 3's builtin |
Python 3 details#
- agate.csv_py3.reader(*args, **kwargs)#
A replacement for Python’s
csv.reader()
that usescsv_py3.Reader
.
- agate.csv_py3.writer(*args, **kwargs)#
A replacement for Python’s
csv.writer()
that usescsv_py3.Writer
.
- class agate.csv_py3.Reader(f, field_size_limit=None, line_numbers=False, header=True, **kwargs)#
A wrapper around Python 3’s builtin
csv.reader()
.
- class agate.csv_py3.Writer(f, line_numbers=False, **kwargs)#
A wrapper around Python 3’s builtin
csv.writer()
.
- class agate.csv_py3.DictReader(f, fieldnames=None, restkey=None, restval=None, dialect='excel', *args, **kwds)#
A wrapper around Python 3’s builtin
csv.DictReader
.
- class agate.csv_py3.DictWriter(f, fieldnames, line_numbers=False, **kwargs)#
A wrapper around Python 3’s builtin
csv.DictWriter
.