Funny thing, today I used namedtuples from header.
You can use starmap from itertools.
You can use starmap from itertools.
import csv from collections import namedtuple from pathlib import Path from itertools import starmap def read_nt(csv_file): with csv_file.open() as fd: reader = csv.reader(fd, delimiter=",") header = namedtuple("Header", next(reader)) for row in starmap(header, reader): yield row # you have to change the path csv_file = Path.home() / "Desktop/akku.csv" for row in read_nt(csv_file): print(row)It would be nice, to have this inside the csv-module.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
All humans together. We don't need politicians!