I have a function that should use the value of the key that we pass as argument. The key would lookup the value in a nested dictionary. Ex:
nested_dict = ... # dump from json a very nested dictionary
def get_value(nested_dict, composed_key):
# ? nested_dict[composed_key]
Is there a way to do this :
get_value(nested_dict, ["level1"]["level2"]...["leveln"])
Or :
get_value(nested_dict, "level1.level2...leveln")
?
How can I do?
Thanks