I am accessing some data through an API where I need to provide the date range for my request, ex. start=\'20100101\', end=\'20150415\'. I thought I would speed this up by
Could you use the datetime.date objects instead?
If you do:
import datetime
begin = datetime.date(2001, 1, 1)
end = datetime.date(2010, 12, 31)
intervals = 4
date_list = []
delta = (end - begin)/4
for i in range(1, intervals + 1):
date_list.append((begin+i*delta).strftime('%Y%m%d'))
and date_list should have the end dates for each inteval.