方法:
import datetime
for x in xrange(1, 13):
dt_start = (datetime.datetime(2016, x, 1)).strftime("%Y%m%d")
if 12 == x:
dt_end = (datetime.datetime(2016, 12, 31)).strftime("%Y%m%d")
else:
dt_end = (datetime.datetime(2016, x+1, 1) - datetime.timedelta(days = 1)).strftime("%Y%m%d")
print dt_start, dt_end