title: Python Dict : adding a value in a key already made without losing the original value
body: <p>I am trying to add a xml file in a dict. Now What i want to do is to update the value into the dict without losing the value. Reason for this is I want to group the xml file to show all the changes made by the tag author.</p>
  
  <p>Here is a sample of the xml file. </p>
  
  <pre><code>&lt;log&gt; 
  &lt;logentry 
  revision="33185"&gt; 
  &lt;author&gt;glv&lt;/author&gt; 
  &lt;date&gt;2012-08-06T21:01:52.494219Z&lt;/date&gt; 
  &lt;paths&gt; 
  
  &lt;path 
  kind="file" 
  action="M"&gt;/branches/Patch_4_2_0_Branch/text.xml&lt;/path&gt;    
  
  &lt;path 
  kind="dir" 
  action="M"&gt;/branches/Patch_4_2_0_Branch&lt;/path&gt; 
  
  &lt;/paths&gt; 
  &lt;msg&gt;PATCH_BRANCH:N/A 
  BUG_NUMBER:N/A 
  FEATURE_AFFECTED:N/A 
  OVERVIEW:N/A 
  Adding the SVN log size requirement to the branch  
  &lt;/msg&gt; 
  &lt;/logentry&gt; 
   .... 
  &lt;/log&gt; 
  </code></pre>
  
  <p>Here is the code I have for it written in Python.</p>
  
  <pre><code>from xml.dom import minidom 
  import smtplib 
  from email.mime.text import MIMEText 
  from datetime import datetime 
  
  def xml_data (): 
  
  f = open('C:\opidea_2.xml', 'r') 
  
  data = f.read() 
  
  f.close() 
  
  dom = minidom.parseString(data) 
  
  ic = (dom.getElementsByTagName('logentry')) 
  
  dom = None       
  content = '' 
  author = {}   
  for num in ic: 
  
  authors = num.getElementsByTagName('author') 
  
  if len(authors) &gt; 0: 
  
    name = authors[0].firstChild.nodeValue 
  
    author.update({'author': str(name)})  
  
  datef = [] 
  xmlDate = num.getElementsByTagName('date')[0].firstChild.nodeValue 
  datef = [Good_Time] 
  path_change = []  
  paths = [x for x in num.getElementsByTagName("paths")[0].childNodes if isinstance(x, minidom.Element)] 
  
  for path in paths:  
  
    x = path.childNodes[0].nodeValue   
  
  if str(path.getAttribute("kind")) == 'dir': 
  
    path_change ='Directory location: ' + [str(x)] 
  else:  
    path_change ='Filename: ' + [str(x)] 
  
  xmlMsgf = [] 
  xmlMsg = num.getElementsByTagName('msg') 
  
  
  if xmlMsg !='' and len(xmlMsg) &gt; 0: 
    xmlMsgc = xmlMsg[0].firstChild.nodeValue 
    xmlMsgf = [xmlMsgc] 
  
  
   else: 
     xmlMsgc = "No comment made." 
     xmlMsgf = [xmlMsgc] 
  
   authorentry.push{('author',authorA),('date',datef),('path',path_change),('path',xmlMsgf))}           
  
      for k, v in [(authorentry)]:
  
          try:
  
              author[k].append(v)
  
          except KeyError:
  
              author[k] = [v]
  
   author.update({'Date':datef,'Path':path_change,'msg':str(xmlMsgf)}) 
   print author
  
  if __name__ == "__main__": 
    xml_data () 
  </code></pre>
  
  <p>Now what I want the end result to be is like this</p>
  
  <p>Key 1 =  glv , date1 ,path 1a path 1b , msg1 , date2 , path 2 , msg 2 , ...</p>
  
  <p>key 2 =  jsm , date1 , path 1 , msg 1.</p>
  
  <p>I want to group the author.update({'Date':datef,'Path':path_change,'msg':str(xmlMsgf)}) to list the xml file by the authors to append the next set of things the author made. Not very sure how to go about that. Any help would be appreciated. Here is my updated code but I seem to now get an invalid syntax error: </p>
  
  <pre><code>  line 151
      authorentry.push{('author',authorA),('date',datef),('path',path_change),('path',xmlMsgf))}           
                      ^
   SyntaxError: invalid syntax
  </code></pre>