题
我希望自动化,我要送我的经理的状态报告。由于我使用待办事项软件写入iCalendar格式,我想能够格式的电子邮件从ics文件的。
我开始我的工作有: http://codespeak.net/icalendar/ 看起来相当不错的,但它确实有一些粗糙的边缘。
什么的iCalendar读者,你会建议为Python?
解决方案
我知道这个问题是旧的,但是这看起来是最流行的Python的iCalendar解析这些天。它的问世PyPI上。
的PyPI页: https://pypi.python.org/pypi/icalendar
文档: http://icalendar.readthedocs.org/en/latest/ 结果
Github上: https://github.com/collective/icalendar
其他提示
有是 ics.py 具有非常“Python的”接口和摘要掉不iCalendar格式 RFC5545 的非常直观的语法。
示例:
>>> from ics import Calendar, Event
>>> from datetime import datetime
>>> c = Calendar()
>>> e = Event()
>>> e.name = "My cool event"
>>> e.begin = '20140101 10:00:00'
>>> e.end = datetime(2014, 1, 1, 11, 30)
>>> c.events.append(e)
>>> c.events
[<Event 'My cool event' begin:2014-01-01 10:00:00 end:2014-01-01 11:30:00>]
>>> with open('my.ics', 'w') as my_file:
>>> my_file.writelines(c)
不隶属于 StackOverflow