title: Is there a dict + list comprehension way to do this?
body: <p>I am trying to solve the following problem using dict and list comprehension. Given</p>
  <pre><code>input = {&quot;a&quot;:[&quot;b&quot;,&quot;c&quot;], &quot;d&quot;:[&quot;b&quot;,&quot;e&quot;], &quot;f&quot;:[&quot;g&quot;,&quot;c&quot;]}
  </code></pre>
  <p>expected output is ::</p>
  <pre><code>output = {&quot;b&quot;:[&quot;a&quot;,&quot;d&quot;], &quot;c&quot;:[&quot;a&quot;,&quot;f&quot;], &quot;e&quot;:[&quot;d&quot;], &quot;g&quot;:[&quot;f&quot;]}
  </code></pre>
  <p>So far, I have only been able to come up with ::</p>
  <pre><code>output = {}
  for (k,v) in input.items():
      for x in v:
          if x[0] not in output:
              output[x[0]] = [k]
          else:
              output[x[0]].append(k)
  </code></pre>
  <p>What would be a possible one line dict+list comprehension method to do this?</p>