Dabei habe ich aber ziemliche Probleme, weshalb ich auf Hilfe hoffe.
Ich hoffe, das Problem ergibt sich aus dem Code:
Code: Alles auswählen
dict_list = [['Hallo', 'Wie gehts?', "a", "b", "c"], ['Sortierung im PFS', '1. Knoten', "d", "e", "f"], ['Sortierung im PFS', '2. Knoten', "g", "h", "i"]]
dictionary = {}
dict = {}
for dict_ele in dict_list:
print(str(dict_ele[0]) + " --- " + str(dict_ele[1]) + " --- " + str(dict_ele[2:]))
dict[dict_ele[1]] = dict_ele[2:]
dictionary[dict_ele[0]] = dict[dict_ele[1]]
print('---')
print("Meine Ausgabe: " + str(dictionary))
print("Gewollt: " + str("{'Hallo': {'Wie gehts': ['a', 'b', 'c']}, 'Sortierung im PFS': {'1. Knoten': ['d', 'e', 'f'], '2. Knoten': [['g', 'h', 'i']]}})"))
Code: Alles auswählen
Hallo --- Wie gehts? --- ['a', 'b', 'c']
Sortierung im PFS --- 1. Knoten --- ['d', 'e', 'f']
Sortierung im PFS --- 2. Knoten --- ['g', 'h', 'i']
---
Meine Ausgabe: {'Hallo': ['a', 'b', 'c'], 'Sortierung im PFS': ['g', 'h', 'i']}
Gewollt: {'Hallo': {'Wie gehts': ['a', 'b', 'c']}, 'Sortierung im PFS': {'1. Knoten': ['d', 'e', 'f'], '2. Knoten': [['g', 'h', 'i']]}})