import csv
def csv_reader(file, header=False):
with open(file, "r") as f:
reader = csv.reader(f)
if header:
next(reader)
yield from reader
def main():
g = csv_reader("xxx.csv", header=False)
print(next(g)) # =>Première ligne
if __name__ == '__main__':
main()
yield from reader
Est
for row in reader:
yield row
Mais cela peut être mis en œuvre.