1 2 3 4 5 6 7 8 9
now = datetime.now() year = now.year - 1 for month in xrange(now.month, now.month + 13): if month > 12: month -= 12 year = now.year date = datetime(year, month, 1) print date.strftime("%b %Y")