最佳答案
我想创建一个日期列表,从今天开始,追溯到任意天数,例如,在我的示例中是100天。还有比这更好的办法吗?
import datetime
a = datetime.datetime.today()
numdays = 100
dateList = []
for x in range (0, numdays):
dateList.append(a - datetime.timedelta(days = x))
print dateList