add some basics

This commit is contained in:
2025-11-19 19:50:01 +03:00
parent 5bca62ec04
commit 2436c0fe2b
8 changed files with 227 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
import csv
def parse_csv_to_structure(path):
result = {}
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
return result
if __name__ == "__main__":
data = parse_csv_to_structure("input.csv")
print(data)