aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorHåkon Solbjørg <hakon@solbj.org>2023-02-23 19:08:52 +0100
committerHåkon Solbjørg <hakon@solbj.org>2023-02-23 19:08:52 +0100
commitaf7e5a3b3be6e9ca82eef4b4e340b1c7e6ef6115 (patch)
tree5504564c6febb69c3a3c59a669b9e0357cc55e57 /tools
parentec8386d110d0632d29ee6679c0c8c4a2a7742797 (diff)
feat(koblingsplan): Write YAML to file
Diffstat (limited to 'tools')
-rw-r--r--tools/koblingsplan/script.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/tools/koblingsplan/script.py b/tools/koblingsplan/script.py
index c27eda9..8fdc518 100644
--- a/tools/koblingsplan/script.py
+++ b/tools/koblingsplan/script.py
@@ -8,6 +8,9 @@
import csv
import yaml
+# Holds all data. List of objects, each object represents a row in the table
+dataset = []
+
with open('tg23-koblingsplan.csv', newline='') as csvfile:
csv_data = csv.reader(csvfile, delimiter=',', quotechar='"')
@@ -17,9 +20,6 @@ with open('tg23-koblingsplan.csv', newline='') as csvfile:
# Holds the data from the current iteration
current_iteration = {}
- # Holds all data. List of objects, each object represents a row in the table
- dataset = []
-
for row in csv_data:
i += 1
# skip first 2 lines, they only contain table headers
@@ -54,4 +54,5 @@ with open('tg23-koblingsplan.csv', newline='') as csvfile:
dataset.append(current_iteration)
- print(yaml.dump(dataset, default_flow_style=False, sort_keys=False, allow_unicode=True))
+with open('tg23-koblingsplan.yml', 'w') as f:
+ f.write(yaml.dump(dataset, default_flow_style=False, sort_keys=False, allow_unicode=True))