Python CSV Module
CSV file reading and writing — reader, writer, DictReader, DictWriter. This category documents 7 Python csv module entries, and each page gives you the full syntax, the parameter list, the return value, and a runnable example. The entries include: csv.reader(), csv.writer(), csv.DictReader(), csv.DictWriter(), csv.writer.writerow(), csv.writer.writerows(), csv.Sniffer().sniff(). csv.reader() returns a reader object that iterates over lines in a CSV file. csv.writer() returns a writer object for writing rows to a CSV file. csv.DictReader() returns a reader that maps each row to a dict with field names as keys. csv.DictWriter() returns a writer that maps dicts to CSV rows using fieldnames. csv.writer.writerow() writes a single row to the CSV file (row is a sequence of values). For a structured walkthrough of the whole topic, read the CSV Module guide. CSV Module belongs to the File & Data group alongside Pathlib Module, Shutil Module, Glob Module, Fileinput Module.