For example - i have a multylevel nested dictionary
mydict = {"level00": {
"level01":["1","2","3"],
"level02":{"level10":"Value1","level11":"Value2"},
"level03":{"level11":{"level21":[1,2,3,4],"level22":"Value3"}
}
}
To get a "Value3" , for example, i should set a tree of indexes like :
print(mydict["level00"]["level03"]["level11"]["level22"]) # will get a "Value3"
So my queston is , if i know all dictionary keys, how can i pass this tree as a list to a function, to get any value from the dictionary ? Something like :
keylist = ["level00","level03","level11","level22"]
neededvalue = getavalue(keylist) #function to return a value from the distionary
keylist can be different
May be there is a way to transform a list to the indexes tree ??
Are the any other ways unless an iterations ??