George Sakkis wrote: > "Chris" <[EMAIL PROTECTED]> wrote: >>Is there a way to make python create a list of Mondays for a given year? > > 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))
Count should probably be at least "53" to catch the years when there are that many Mondays.... such as 2001. Unfortunately, I suspect that will screw it up for other years where there are only 52 (but I don't know this dateutil package so someone who does would have to say for sure). -Peter -- http://mail.python.org/mailman/listinfo/python-list