title: Python: get all months in range?
body: <p>I want to get all months between now and August 2010, as a list formatted like this:</p>
  
  <pre><code>['2010-08-01', '2010-09-01', .... , '2016-02-01']
  </code></pre>
  
  <p>Right now this is what I have:</p>
  
  <pre><code>months = []
  for y in range(2010, 2016):
      for m in range(1, 13):
          if (y == 2010) and m &lt; 8:
              continue
          if (y == 2016) and m &gt; 2:
              continue
          month = '%s-%s-01' % (y, ('0%s' % (m)) if m &lt; 10 else m)
          months.append(month)
  </code></pre>
  
  <p>What would be a better way to do this?</p>