csvkit

This module contains csvkit’s superpowered reader and writer. The greatest improvement over the standard library versions is that these versions are completely unicode aware and can support any encoding by simply passing in the its name at the time they are created.

This module defines reader, writer, DictReader and DictWriter so you can use it as a drop-in replacement for csv. Alternatively, you can instantiate CSVKitReader, CSVKitWriter, CSVKitDictReader and CSVKitDictWriter directly.

class csvkit.CSVKitReader(f, encoding='utf-8', maxfieldsize=None, **kwargs)

A unicode-aware CSV reader. Currently adds nothing to csvkit.unicsv.UnicodeCSVReader, but might someday.

line_num
next()
class csvkit.CSVKitWriter(f, encoding='utf-8', line_numbers=False, **kwargs)

A unicode-aware CSV writer with some additional features.

writerow(row)
writerows(rows)
class csvkit.CSVKitDictReader(f, fieldnames=None, restkey=None, restval=None, *args, **kwargs)

A unicode-aware CSV DictReader. Currently adds nothing to csvkit.unicsv.UnicodeCSVWriter, but might someday.

fieldnames
next()
class csvkit.CSVKitDictWriter(f, encoding='utf-8', line_numbers=False, **kwargs)

A unicode-aware CSV DictWriter with some additional features.

writerow(row)
writerows(rows)
writeheader()
csvkit.reader(*args, **kwargs)

A drop-in replacement for Python’s csv.reader() that leverages csvkit.CSVKitReader.

csvkit.writer(*args, **kwargs)

A drop-in replacement for Python’s csv.writer() that leverages csvkit.CSVKitWriter.

csvkit.DictReader

alias of CSVKitDictReader

csvkit.DictWriter

alias of CSVKitDictWriter