Python dateutils print recurrence rule according to iCalendar format (see RFC 5545)

前端 未结 3 630
小蘑菇
小蘑菇 2020-12-16 21:07

I am trying to print a recurrence rule as a string specified by iCalendar format (see RFC 5545). Im using python dateutils, in particular dateutil.rrule to create the recurr

3条回答
  •  天命终不由人
    2020-12-16 21:21

    Although this is written four years after the question was asked, dateutil by now has a __str__ method (see source code) which allows one to print its objects in such a form:

    In [1]: from dateutil.rrule import *
    
    In [2]: my_rrule = rrule(DAILY, count=5)
    
    In [3]: print(my_rrule)
    DTSTART:20161202T184513
    FREQ=DAILY;COUNT=5
    

提交回复
热议问题