title: Get the second element of tuple from dictionary key
body: <p>I have the following dict:</p>
  
  <blockquote>
    <p>{('I', 'like'):14,  ('he','likes'):2, ('I', 'hate'):12}</p>
  </blockquote>
  
  <p>For a given <code>word</code> string I want to get the second element of <strong>all tuples</strong> in dictionary (which is a key of a dictionary) that has this <code>word</code> as the first element.
  I tried:</p>
  
  <pre><code>word='I'    
  second_word = (k[0][1] for k, v  in d if word == k[0][0])
  print(second_word)
  </code></pre>
  
  <p>and expected to get <em>"like"</em> as an answer but got:</p>
  
  <pre><code>&lt;generator object generate_ngram_sentences.&lt;locals&gt;.&lt;genexpr&gt; at 0x7fed65bd0678&gt;
  &lt;generator object generate_ngram_sentences.&lt;locals&gt;.&lt;genexpr&gt; at 0x7fed65bd0678&gt;
  &lt;generator object generate_ngram_sentences.&lt;locals&gt;.&lt;genexpr&gt; at 0x7fed65bd06d0&gt;
  </code></pre>
  
  <ol>
  <li><strong>How to get not only first occurrence but all of such occurrences in dictionary?</strong></li>
  </ol>
  
  <p>EDIT:
  2. <strong>Can you share how could it be modified in case the size of the tuple to be dynamic. So that the key of the dict would store eg. 2elem tuple or 15elem etc. tuple depending on dict?</strong></p>