Creating a Semester's Class Schedule

I just discovered Python’s awesome dateutil package which implements much of the iCalendar standard, including recurrences! Consequently, it’s trivial to generate a calendar for the days classes meet. I assume with a little work one could even handle the holidays. In any case, here’s an example:


from dateutil.rrule import *
from dateutil.parser import *

sem_start = '20070903T140000'
sem_end = '20071212T140000'
days = MO,WE

meetings = list(rrule(WEEKLY, wkst=SU, byweekday=(days),
    dtstart=parse(sem_start), until=parse(sem_end)))
for meeting in meetings:
    print meeting.strftime("%b %d %a")

Comments !