csv module

The standard library's csv module reads and writes CSV files. csv.reader and csv.DictReader iterate over rows, csv.writer and csv.DictWriter write them, with a separator (delimiter) and an encoding to specify. Open the file with newline=''; quotes are handled correctly.

Example

with open('a.csv', newline='', encoding='utf-8') as f:
    for ligne in csv.DictReader(f):
        print(ligne['nom'])

Related concepts

The whole glossary