here is a small code
ds = datetime.datetime.now()
de = ds + datetime.timedelta(days=99)
fd = list(rrule(DAILY, byweekday=(SA,SU), dtstart=ds, until=de))
for x in fd:
print fd[x-1]
it should give me a list of datetime() objects. but it doesn’t. here is the error method i got
Traceback (most recent call last):
File "<pyshell#23>", line 1, in <module>
int(fd[0])
TypeError: int() argument must be a string or a number, not 'datetime.datetime'
what could be wrong?
You cannot subtract the
int1from adatetime.datetimeobject.xis a item from thelistofdatetime.datetimeobjects calledfd, not an index.Where you have:
You want:
This will give you a list of c. 29 items (depending on when you run it, naturally):