Skip to content

Instantly share code, notes, and snippets.

View weichaojie's full-sized avatar

weichaojie weichaojie

View GitHub Profile
@lukasmartinelli
lukasmartinelli / semester_report
Created February 15, 2014 16:43
Calculate the total time based on the summary and time of iCalendar Events
from icalendar import Calendar
from datetime import timedelta
from itertools import groupby
from operator import itemgetter
def calculate_time(event):
start = event['DTSTART'].dt
end = event['DTEND'].dt
return end - start