I was wondering how I can find values and its index on a list that may store another list in it.
I have taken a look at this post, but it does not work if there is a list inside of the list that is being searched.
Here is what I mean. Given the input:
["foo", ["f", "g"], "bar", "a", ["b", "c", "d"]]
Is it possible to find, for example, "f"
and also return its index?
I know I could use recursion or something, but is there a faster and more elegant solution?
EDIT:
Also, the list may have more than one lists in it. For example, the list could be:
["foo", ["f", ["b", "c", "d"], "g"], "bar", "a"]
I need this in Python 3.