calendar (date) iterator?

skip at pobox.com skip at pobox.com
Tue Mar 6 21:19:54 CET 2007


    Marcus> I'm looking for useful starting points, suggestions, and sample
    Marcus> code, to implement a calendar iterator.  

Have you looked at dateutil?

    http://labix.org/python-dateutil

    >>> from dateutil.rrule import rrule, DAILY
    >>> from dateutil.parser import parse
    >>> rule = rrule(DAILY, count=5, dtstart=parse("2006-03-12"))
    >>> for d in rule:
    ...   print d
    ...
    2006-03-12 00:00:00
    2006-03-13 00:00:00
    2006-03-14 00:00:00
    2006-03-15 00:00:00
    2006-03-16 00:00:00

Skip



More information about the Python-list mailing list