2019-2020/Formations/NSI/Bloc1/diubloc1-files-td6/ex_csvlib.py

10 lines
265 B
Python
Raw Permalink Normal View History

2020-05-05 07:53:14 +00:00
# cf https://docs.python.org/fr/3/library/csv.html
import csv
fieldnames = ['x', 'y']
with open('donnees-2-colonnes.csv', newline='') as csvfile:
reader = csv.DictReader(csvfile, fieldnames=fieldnames)
for row in reader:
print(row['x'], row['y'])