title: Find the sentence’s index (sentences in a list) of a specific word in Python
body: <p>i currently have a file that contains a list that is looks like</p>
  
  <pre><code>example = ['Mary had a little lamb' , 
         'Jack went up the hill' , 
         'Jill followed suit' ,    
         'i woke up suddenly' ,
         'it was a really bad dream...']
  </code></pre>
  
  <p>I would like to find the index of the sentence with the word “woke” by example.
  In this example the answer should be f(“woke”)=3. F is a function.</p>
  
  <p>I tried to tokenize each sentence to first find the index of the word like that:</p>
  
  <pre><code>&gt;&gt;&gt; from nltk.tokenize import word_tokenize
  &gt;&gt;&gt; example = ['Mary had a little lamb' , 
  ...            'Jack went up the hill' , 
  ...            'Jill followed suit' ,    
  ...            'i woke up suddenly' ,
  ...            'it was a really bad dream...']
  &gt;&gt;&gt; tokenized_sents = [word_tokenize(i) for i in example]
  &gt;&gt;&gt; for i in tokenized_sents:
  ...     print i
  ... 
  ['Mary', 'had', 'a', 'little', 'lamb']
  ['Jack', 'went', 'up', 'the', 'hill']
  ['Jill', 'followed', 'suit']
  ['i', 'woke', 'up', 'suddenly']
  ['it', 'was', 'a', 'really', 'bad', 'dream', '...']
  </code></pre>
  
  <p>But I don’t know how to finally get the index of the word and how to link it to the sentence’s index. Does someone know how to do that?</p>