title: How do I group this list of dicts by the same month?
body: <p>Python newb...
  I have a list of dicts that I am trying to organize into the same month &amp; year:</p>
  
  <pre><code>[{'date':'2008-04-23','value':'1'},
  {'date':'2008-04-01','value':'8'},
  {'date':'2008-04-05','value':'3'},
  {'date':'2009-04-19','value':'5'},
  {'date':'2009-04-21','value':'8'},
  {'date':'2010-09-09','value':'3'},
  {'date':'2010-09-10','value':'4'},
  ]
  </code></pre>
  
  <p>What I'm trying to get is a list of dicts like this:</p>
  
  <pre><code>[{'date':2008-04-01,'value':'12'},
  {'date':2009-04-01,'value':'13'},
  {'date':2010-09-01,'value':'7'},
  ]
  </code></pre>
  
  <p>Here's my code, which is just printing an empty list:</p>
  
  <pre><code>from datetime import datetime
  
  myList = [{'date':'2008-04-23','value':'1'}, {'date':'2008-04-01','value':'8'}, {'date':'2008-04-05','value':'3'}, {'date':'2009-04-19','value':'5'}, {'date':'2009-04-21','value':'8'},{'date':'2010-09-09','value':'3'},
      {'date':'2010-09-10','value':'4'},
      ]
  
  newList = []
  newDict = {}
  
  for cnt in range(len(myList)):
      for k,v in myList[cnt].iteritems():
          if k == 'date':
              d = datetime.strptime(v,'%Y-%m-%d').date()
              for elem in newList:
                  if elem['date'] != d:
                      newList.append({'date':d,'value':myList[cnt]['value']})
                  else:
                      newList[cnt]['value'] += myList[cnt]['value']
  
  print newList   
  </code></pre>