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)) # =>Erste Linie
if __name__ == '__main__':
main()
yield from reader
Ist
for row in reader:
yield row
Aber es kann implementiert werden.