Created
November 15, 2016 13:00
-
-
Save jonperron/e74ab46eae5e39cec5e6ea897dc60c4c to your computer and use it in GitHub Desktop.
Python 2.x month generator, using python-dateutil (https://dateutil.readthedocs.io/)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def monthrange(start_date,end_date): | |
for n in range(relativedelta(end_date,start_date).years * 12 + relativedelta(end_date,start_date).months + 1): | |
yield start_date + n*relativedelta(months=1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment