From 4a77a81d349d81bf9ed479bb3b8ddedb1c22aa82 Mon Sep 17 00:00:00 2001 From: Thomas Schmucker Date: Wed, 8 Jul 2020 18:35:26 +0200 Subject: Vergleichsprogramme in Ruby und Python hinzugefügt. csv-perf.c von unnötigem Code befreit. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- csv-parser.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 csv-parser.py (limited to 'csv-parser.py') diff --git a/csv-parser.py b/csv-parser.py new file mode 100755 index 0000000..9029321 --- /dev/null +++ b/csv-parser.py @@ -0,0 +1,18 @@ +#! /usr/local/bin/python3.7 + +import csv, time, sys + +with open(sys.argv[1]) as csv_file: + start = time.time() + csv_reader = csv.reader(csv_file, delimiter=',') + line_count = 0 + for row in csv_reader: + if line_count == 0: + line_count += 1 + else: + line_count += 1 + + end = time.time() + print(f'Processed {line_count} lines.') + print(end - start) + -- cgit v1.3