I have a string that could be different lengths, and I want to create a nested dictionary. I have this so far, and just cant seem to figure out how to get over the variable depth issue.
string = "a/b/c/b"
x = string.split('/')
y = {}
for item in x:
y[item] = dict()
.............
I have tried many different ways, but just don't know how to build it dynamically. The final result I would like to get to is:
{'a' :{'b' : {'c': {'d': {}}}}
Would love some feedback on design and ideas to get this going.
Thanks,