I have an output (a list) of items, like such:
Root
Branch1
LeafA
LeafB
Branch2
LeafC
LeafZ
LeafD
They are all two-space delimited.
I want build a logical representation of this list without the leading spaces, and retain the parent-child relationshiop.
A final possible result:
aDict = {
'Root': null,
'Branch1': 'Root',
'LeafA': 'Branch1',
... so on and so forth
}
Ultimately, I want to iterate through the dictionary and retrieve the Key and parent, as well as another value from another dict based on Key.
Try this: