Chris <[EMAIL PROTECTED]> writes: > Is there a way to make python create a list of Mondays for a given year? > mondays = ['1/3/2005','1/10/2005','1/17/2005','1/24/2005', > '1/31/2005','2/7/2005', ... ]
This is pretty inefficient but it's conceptually the simplest: def mondays(year): from calendar import weekday, monthrange return [('%d/%d/%d'%(month,day,year)) for month in xrange(1,13) for day in xrange(1,1+monthrange(year,month)[1]) if weekday(year,month,day) == 0] -- http://mail.python.org/mailman/listinfo/python-list