import csv import sys with open(sys.argv[1], newline='') as csvfile: reader = csv.DictReader(csvfile) for row in reader: print(len(row))