I\'ve been tinkering in python this week and I got stuck on something. If I had a 2D list like this:
myList = [[1,2],[3,4],[5,6]]
and
Try this:
def index_2d(myList, v): for i, x in enumerate(myList): if v in x: return (i, x.index(v))
Usage:
>>> index_2d(myList, 3) (1, 0)