some terror with structures

This commit is contained in:
2025-12-01 02:19:22 +03:00
parent 4cfadd14e0
commit 52cd77735c
7 changed files with 171 additions and 12 deletions
+6 -5
View File
@@ -1,24 +1,25 @@
import csv
def parse_csv_to_structure(path):
result = {}
with open(path, newline='') as f:
with open(path, newline="") as f:
reader = csv.reader(f)
rows = list(reader)
headers = rows[0][1:]
for row in rows[1:]:
obj = row[0].strip()
if not obj:
continue
result[obj] = {}
for header, value in zip(headers, row[1:]):
value = value.strip()
if value:
result[obj][header] = value