Folks, I am using solution described at following location How to use a dot "." to access members of dictionary?
I will minimize the solution here to explain the objective. Basically I am looking for a solution that can take nested keys structure in string format from the user and queries dictionary. I used solution above to convert dictionary in dot notation searchable format. However following is where I am stuck
data = {
"Country" : {
"US" : [ {"Connecticut" : "Hartford"} , {"California" : "Sacramento"} ]
}
### Following works
f = Map(data)
print(f.Country.US[1].California)
Sacramento
### Following does not work
s = 'Country.US[1].California'
print(f[s])
What I need is a solution that could take externally provided key structure and turns into searchable dot-notation
What can be done?