Creating a list of Mondays for a year
George Sakkis
gsakkis at rutgers.edu
Sun Sep 18 18:58:33 EDT 2005
"Chris" <secun at yahoo.com> wrote:
> Is there a way to make python create a list of Mondays for a given year?
>
> For example,
>
> mondays = ['1/3/2005','1/10/2005','1/17/2005','1/24/2005',
> '1/31/2005','2/7/2005', ... ]
Get the dateutil package (https://moin.conectiva.com.br/DateUtil):
import dateutil.rrule as rrule
from datetime import date
mondays2005 = tuple(rrule.rrule(rrule.WEEKLY,
dtstart=date(2005,1,1),
count=52,
byweekday=rrule.MO))
George
More information about the Python-list
mailing list