Given a nested list with a known depth n, one can access the topmost elements based on repeating the 0 index n times, for example
single_nested_list = [{'foo':['bar']}]
double_nested_list = [[{'foo':['bar']}]]
single_nested_list[0]
#returns {'foo': ['bar']}
double_nested_list[0][0]
#returns {'foo': ['bar']}
and so on...
Knowing the depth variable in advance, and assuming on the first index of each list needs to be accessed, what would be the correct syntax for accessing a nested list with n depth?
For example, if I have a triple nested list, I would need to repeat the index 3 times: [0][0][0]
triple_nested_list = [[[{'foo':['bar']}]]]
This attempt fails:
n = 3
e = [0]
triple_nested_list[[e] * n]
Any advice on how to create an n-repeating list index would be appreciated!