在Python中迭代一系列日期
day_count = (end_date - start_date).days + 1for single_date in [d for d in (start_date + timedelta(n) for n in range(day_count)) if d <= end_date]: print strftime("%Y-%m-%d", single_date.timetuple())
start_date
end_date
datetime.date
2009-05-30
2009-06-09
:
2009-05-30
2009-05-31
2009-06-01
2009-06-02
2009-06-03
2009-06-04
2009-06-05
2009-06-06
2009-06-07
2009-06-08
2009-06-09
慕少森
慕标5832272
眼眸繁星
相关分类