Python ical:获取一天的活动,包括重复活动

Mar*_*ark 6 python icalendar datetime rfc5545

有没有一种简单的方法可以从Python中的ical文件中获取一天的事件?

对于非经常性的,有一天的事件,我使用了类似的东西

from icalendar import Calendar
for event in Calendar.from_ical(ical).walk('vevent'):
    if edate > ref_ref_day_start and event.get('dtstart').dt < ref_day_end:
        # code here
Run Code Online (Sandbox Code Playgroud)

但重复发生的事件只发生walk一次.

我可以看到如何在没有结束的情况下重复事件的无限事件迭代可能是一个问题.但仍然必须有一个比自己计算重复更简单的方法,对吗?

(我找不到太多的文档.我阅读了与重复发生的事件相关的icalendar测试,但它似乎没有做这样的事情).

小智 1

Yeah.Instead of Ical Do it 通过 gcalcli

gcalcli 是一个 Python 应用程序,允许您从命令行访问 Google 日历

[1]: https: //github.com/insanum/gcalcli