title: Concatenating Unique Values from List of Dictionaries with sames Keys in Python
body: <p>I am working with a list of dictionaries and am trying to combine them into one with the following conditions:</p>
  
  <ol>
  <li>The dictionaries in the list all have the same keys, and the new dictionary will as well</li>
  <li>If the values for a given key across all dictionaries is the same, then that value will appear once in the value for the new dictionary</li>
  <li>If the values for a given key across as dictionaries are unique, then the value for that key in the new dictionary will be a comma seperated string of all the values</li>
  </ol>
  
  <p>So really what I am trying to do is create a set for a given key across multiple dictionaries, and create a comma seperated string of that set for the value in a new dictionary.  To help visualize, given:</p>
  
  <pre><code>data = [ {"key1": "value1", "key2": "value2", "key3": "value3"},  
           {"key1": "value4", "key2": "value5", "key3": "value3"}, 
           {"key1": "value1", "key2": "value8", "key3": "value3"} ]
  </code></pre>
  
  <p>I want to make a new dictionary out of data that would like as follows:</p>
  
  <pre><code>myDict = {"key1": "value1, value4", "key2": "value2, value5, value8", "key3": "value3"}
  </code></pre>
  
  <p>Any ideas on how to accomplish this?</p>