Python开始时间

时间:2015-12-02 22:15:53

标签: python calendar icalendar

这是我的问题,我在Python上使用Icalendar来解析来自2个文件和一个excel文件(xls)的数据。 问题,当我尝试获取我的日历时(使用此):

    for event in cal.walk('vevent'):
        dates = event.get('dtstart')
        location = event.get('location')
        dates=dates.to_ical()
        month=dates[4:6]
        day=dates[6:8]
        heures2=dates[9:11]
        minut=dates[11:13]
        sec=dates[13:15]
        yearical=dates[0:4]
        date2=day+"/"+month+"/"+yearical
        summary = event.get('summary')
        icaldebheur = heures2+":"+minut+":"+sec

问题是我的文件看起来像这样: Calendar 代码给我的唯一一小时是8H one和13h30one(通过打印debheur观察),无论白天,它都不会在10H给我一个(或者,如果它发生在下午,它不会给我15点15分)。 好像它每天只给我2个事件。

你有什么想法吗?

1 个答案:

答案 0 :(得分:0)

处理iCalendar文件时必须注意的一件事是时区

  • 如果日期/时间属性值以Z结尾,则表示时间是 格式为 UTC时间
  • 如果日期/时间属性有TZID 参数,表示日期/时间值的格式为特定 时区即可。
相关问题