[ create a new paste ] login | about

Link: http://codepad.org/5yXc314H    [ raw code | fork ]

Python, pasted on May 12:
fhand = open('calendar.ics')
fout = open('calendarstripped.csv','w')
headerline = 'Event' + '\t' + 'Organizer' + '\t' + 'Date start' + '\t' + 'Time start' + '\t' + 'Date End' + '\t' + 'Time end' + '\t' + 'Modified date' + '\t' + 'Modified time' + '\t' + 'Created date' + '\t' + 'Created time' + '\n'
fout.write(headerline)
for line in fhand:
    line = line.rstrip()
    if line.startswith('SUMMARY:') :##or line.startswith('DESCRIPTION:'):
        colpos=line.find(':')
        line = line[colpos+1:len(line)]
        line = line + '\t'
        fout.write(line)
    elif line.startswith('DTSTART;') or line.startswith('DTEND') or line.startswith('LAST-MODIFIED') or line.startswith('DTSTAMP'):
        colpos=line.find(':')
        line = line[colpos+1:len(line)]
        if 'T' in line:
            timepos = line.find('T')
            date=line[0:timepos]
            date = date[4:6] +'/'+date[6:]+'/'+date[0:4]
            time=line[timepos+1:len(line)]
            time = time[0:2]+':'+time[2:4]
            line = date + '\t' + time + '\t'
        else:
            line = line[4:6]+'/'+line[6:]+'/'+line[0:4] +'\t' +'\t'
        fout.write(line)
    elif line.startswith('ORGANIZER'):
        colpos=line.find(':')
        atpos=line.find('@')
        line = line[colpos+1:atpos]
        line = line + '\t'
        fout.write(line)
    elif line.startswith('END'):
        line = '\n'
        fout.write(line)
fout.close()


Create a new paste based on this one


Comments: