title: In python - how do I convert items to dict?
body: <p>I have following list of items (key-value pairs):</p>
  
  <pre><code>items = [('A', 1), ('B', 1), ('B', 2), ('C', 3)]
  </code></pre>
  
  <p>What I want to get:</p>
  
  <pre><code>{
    'A' : 1,
    'B' : [1,2]
    'C' : 3
  }
  </code></pre>
  
  <p>My naive solution:</p>
  
  <pre><code>res = {}
  for (k,v) in items:
       if k in res:
           res[k].append(v)
       else:
           res[k] = [v]
  </code></pre>
  
  <p>I'm looking for some optimised more pythonic solution, anyone?  </p>