Access list of lists by list identifier [duplicate]

I have a list of lists, for example:

l = [["A", "B", ["X", "Y", ["J", "K", "L"]]], ["D", "E", "F"]]

I know I can access each element by appending list index to element, for example, to access "F" I can do this:


But I'd like to access it by a list of indexes:

indexes = [1, 2]
l[some_magic_with_indexes_variable] - which would be similar to l[1][2]

How to achieve that?

Read more here:

Content Attribution

This content was originally published by NotI.mportant at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: