From fc9ff4c8b268acfa52f8a6fc39f920848e0186fd Mon Sep 17 00:00:00 2001 From: Dustin Thomas Date: Fri, 1 Mar 2024 19:13:28 -0600 Subject: [PATCH] split lists if they contain more than 2 commas --- read_datasheet.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/read_datasheet.py b/read_datasheet.py index 729c8a9..6b3273d 100755 --- a/read_datasheet.py +++ b/read_datasheet.py @@ -232,6 +232,10 @@ def flatten(tables): print("\"" + keyname + "\":", "\"" + str(out[fullkeyname]) + "\",") + # if the item has at least two commas in it, split it + if tables[table][key].count(',') >= 2: + out[fullkeyname] = map(lambda x: x.strip(), tables[table][key].split(",")) + print("}") return out