title: How to add multiple values to the same key in a Python Dictionary
body: <p>I've got a situation where I am trying to use a Dictionary in Python to keep track of an ID and a CLASSNAME.  I am using a dictionary because I need to know what ID the CLASSNAME belongs to.  However, although I only have one ID, I can have multiple CLASSNAME(S).  Here is a snippet of what I am doing in my code.  Because of the way I am adding the key:value to the dictionary, I only get the last value for that key instead of all of the values.</p>
  
  <pre><code>elementTree = self.param2
  audio = {}
  
  if elementTree.find('./connections') is None:
      return
  else:
      for connection_element in elementTree.findall('.//connections/connection'):
          # Get the type for this connection.
          controlType = connection_element.find('type')
          # Get the id for this connection.
          connectionID = connection_element.find('id')
          if controlType is not None and str(controlType.text) == '6':
              # Now find all of the classname(s) in this specific connection element.
              for class_name in connection_element.findall('classes/class/classname'):
                  audio[connectionID.text] = class_name.text
      return audio
  </code></pre>
  
  <p>Here is an example of the data the above function is trying to parse:</p>
  
  <pre><code>    &lt;connection&gt;
          &lt;id&gt;3002&lt;/id&gt;
          &lt;type&gt;6&lt;/type&gt;
          &lt;classes&gt;
              &lt;class&gt;
                  &lt;classname&gt;DIGITAL_COAX&lt;/classname&gt;
              &lt;/class&gt;
              &lt;class&gt;
                  &lt;classname&gt;DIGITAL_OPTICAL&lt;/classname&gt;
              &lt;/class&gt;
              &lt;class&gt;
                  &lt;classname&gt;STEREO&lt;/classname&gt;
              &lt;/class&gt;
          &lt;/classes&gt;
      &lt;/connection&gt;
  </code></pre>
  
  <p>What I am currently getting back is the 3002:STEREO.  3002 is the ID and STEREO is the CLASSNAME.  What I would like to get back is something like the following:</p>
  
  <pre><code>3002:DIGITAL_COAX
  3002:DIGITAL_OPTICAL
  3002:STEREO
  </code></pre>
  
  <p>How can I properly use the Dictionary to make sure I can assign multiple values to the same key?</p>