from datetime import datetime, timedelta if __name__ == '__main__': startDate = datetime(2019,2,1,0,0) # 2019-02-01 0時0分 endDate = datetime(2019,2,11,23,59) # 2019-02-11 23時59分 currentDate = startDate while(currentDate<=endDate): print currentDate currentDate = currentDate + timedelta(days=1)
timedelta選項有:
weeks
days
hours
minutes
milliseconds
microseconds