❮ CSV
❯
Reading CSV the naive way
examples/csv/plain.csv
Tudor;Vidor;10;Hapci Szundi;Morgo;7;Szende Kuka;Hofeherke;100;Kiralyno Boszorkany;Herceg;9;Meselo
examples/csv/read_csv_split.py
import sys, csv if len(sys.argv) != 2: sys.stderr.write("Usage: {} FILENAME\n".format(sys.argv[0])) exit() filename = sys.argv[1] count = 0 with open(filename) as fh: for line in fh: line = line.rstrip("\n") row = line.split(';') #print(row) count += int(row[2]) print("Total: {}".format(count))
python examples/csv/read_csv_split.py examples/csv/plain.csv