我使用以下程序运行了您的 ICS 文件:
from icalendar import Calendar, Event
from datetime import datetime
cal = open('test.ics','rb')
ical = Calendar.from_ical(cal.read())
for component in ical.walk():
if component.name == 'VEVENT':
for item in component.sorted_items():
if item[0] == 'RECURRENCE-ID':
reoccur_item = item[1]
print reoccur_item.params
print reoccur_item.dt
continue
if item[0] == 'DTSTART':
print 'DSTART', item[1].dt
continue
if item[0] == 'DTEND':
print 'DTEND', item[1].dt
continue
if item[0] == 'DTSTAMP':
print 'DTSTAMP', item[1].dt
continue
print item
cal.close()
以下是我获得的输出
('SUMMARY', vText(u'My Cool Event'))
DSTART 2012-03-29 12:00:00
DTEND 2012-03-29 12:30:00
DTSTAMP 2012-04-11 22:09:38+00:00
('UID', vText(u'040000008200E00074C5B7101A82E008000000000029934B3300CD01000000000000000 0100000001516438BA45C3946AF9C4C2A563FB2BE'))
RECURRENCE-ID Parameters({'TZID': 'Eastern Standard Time'})
RECURRENCE-ID 2012-04-19 12:00:00
('SEQUENCE', 8)
('CLASS', vText(u'PUBLIC'))
('CREATED', <icalendar.prop.vDDDTypes instance at 0x101c4e518>)
('DESCRIPTION', vText(u'\n'))
('LAST-MODIFIED', <icalendar.prop.vDDDTypes instance at 0x1020874d0>)
('LOCATION', vText(u'1501 Fake Street, Conference Room G'))
('PRIORITY', 5)
('TRANSP', vText(u'OPAQUE'))
('X-ALT-DESC', vText(u'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//E N">\n<HTML>\n<HEAD>\n<META NAME="Generator" CONTENT="MS Exchange Server ve rsion 14.02.5004.000">\n<TITLE></TITLE>\n</HEAD>\n<BODY>\n<!-- Converted f rom text/rtf format -->\n\n<P DIR=LTR><SPAN LANG="en-us"></SPAN><SPAN LANG ="en-us"></SPAN></P>\n\n</BODY>\n</HTML>'))
('X-MICROSOFT-CDO-BUSYSTATUS', vText(u'BUSY'))
('X-MICROSOFT-CDO-IMPORTANCE', vText(u'1'))
('X-MICROSOFT-DISALLOW-COUNTER', vText(u'FALSE'))
('X-MS-OLK-APPTLASTSEQUENCE', vText(u'16'))
('X-MS-OLK-APPTSEQTIME', vText(u'20120411T220937Z'))
('X-MS-OLK-AUTOFILLLOCATION', vText(u'FALSE'))
('X-MS-OLK-CONFTYPE', vText(u'0'))
重复发生规则为空,这几乎看起来像重复发生事件的单个实例,但最终是各种 Microsoft 特定数据。其序列号为 8,X-MS-OLK-APPTLASTSEQUENCE:16 表明最后一个实例应具有序列 16。
它几乎看起来像是在每个具有相同 UID 的团队上创建了带有序列标记的多个实例