title: Python, get index from list of lists
body: <p>I have a list of lists of strings, like this:</p>
  
  <pre><code>l = [['apple','banana','kiwi'],['chair','table','spoon']]
  </code></pre>
  
  <p>Given a string, I want its index in l. Experimenting with numpy, this is what I ended up with:</p>
  
  <pre><code>import numpy as np
  l = [['apple','banana','kiwi'],['chair','table','spoon']]
  def ind(s):
      i = [i for i in range(len(l)) if np.argwhere(np.array(l[i]) == s)][0]
      j = np.argwhere(np.array(l[i]) == s)[0][0]
      return i, j
  s = ['apple','banana','kiwi','chair','table','spoon']
  for val in s:
      try:
          print val, ind(val)
      except IndexError:
          print 'oops'
  </code></pre>
  
  <p>This fails for apple and chair, getting an indexerror. Also, this just looks bad to me. Is there some better approch to doing this?</p>