Does anyone out there have a good pythonic idea on how to traverse through datetime (python 3.2.3)?
>>> startDate # 2000-1-1
datetime.datetime(2000, 1, 1, 0, 0)
>>> endDate # 2000-12-31
datetime.datetime(2000, 12, 31, 0, 0)
>>> timestep # every 2 hours
datetime.timedelta(0, 7200)
>>>
Unfortunately the following solution doesn't work as intended:
dictionary={}
for i in range(startDate, endDate, timestep): # <<<< TypeError: 'datetime.datetime' object cannot be interpreted as an integer
dictionary[i]=someValue
Kind Regards,
--
Bjorn