Untitled
from datetime import datetime from ics import Calendar, Event # Create a calendar calendar = Calendar() # BIOL 2042 MICROBIOLOGY LAB - MW 11:00AM to 12:50PM biol_2042_lab = Event() biol_2042_lab.name = "BIOL 2042 MICROBIOLOGY LAB" biol_2042_lab.begin = "2024-08-19 11:00" biol_2042_lab.end = "2024-08-19 12:50" biol_2042_lab.location = "LIFE A228" biol_2042_lab.description = "BIOL 2042 MICROBIOLOGY LAB Section 502" biol_2042_lab.make_all_day(False) biol_2042_lab.rrule = { 'freq': 'weekly', 'byday': ['MO', 'WE'], 'until': datetime(2024, 12, 13, 23, 59) } # PHYS 1420 GEN PHYSICS II - TT 12:30PM to 1:50PM phys_1420 = Event() phys_1420.name = "PHYS 1420 GEN PHYSICS II" phys_1420.begin = "2024-08-20 12:30" phys_1420.end = "2024-08-20 13:50" phys_1420.location = "Phys 102" phys_1420.description = "PHYS 1420 GEN PHYSICS II Section 001" phys_1420.make_all_day(False) phys_1420.rrule = { 'freq': 'weekly', 'byday': ['TU', 'TH'], 'until': datetime(2024, 12, 13, 23, 59) } # PHYS 1420 GEN PHYSICS II - Tuesday 2:00PM to 2:50PM phys_1420_disc = Event() phys_1420_disc.name = "PHYS 1420 GEN PHYSICS II - Discussion" phys_1420_disc.begin = "2024-08-20 14:00" phys_1420_disc.end = "2024-08-20 14:50" phys_1420_disc.location = "SAGE 116" phys_1420_disc.description = "PHYS 1420 GEN PHYSICS II Section 201" phys_1420_disc.make_all_day(False) phys_1420_disc.rrule = { 'freq': 'weekly', 'byday': ['TU'], 'until': datetime(2024, 12, 13, 23, 59) } # PHYS 1440 GEN PHYSIC LAB II - Thursday 3:30PM to 5:50PM phys_1440_lab = Event() phys_1440_lab.name = "PHYS 1440 GEN PHYSIC LAB II" phys_1440_lab.begin = "2024-08-22 15:30" phys_1440_lab.end = "2024-08-22 17:50" phys_1440_lab.location = "HKRY 278" phys_1440_lab.description = "PHYS 1440 GEN PHYSIC LAB II Section 508" phys_1440_lab.make_all_day(False) phys_1440_lab.rrule = { 'freq': 'weekly', 'byday': ['TH'], 'until': datetime(2024, 12, 13, 23, 59) } # PUBH 4050 PUBLIC HEALTH POLICY - MWF 1:00PM to 1:50PM pubh_4050 = Event() pubh_4050.name = "PUBH 4050 PUBLIC HEALTH POLICY" pubh_4050.begin = "2024-08-19 13:00" pubh_4050.end = "2024-08-19 13:50" pubh_4050.location = "LIFE A419" pubh_4050.description = "PUBH 4050 PUBLIC HEALTH POLICY Section 002" pubh_4050.make_all_day(False) pubh_4050.rrule = { 'freq': 'weekly', 'byday': ['MO', 'WE', 'FR'], 'until': datetime(2024, 12, 13, 23, 59) } # Add events to the calendar calendar.events.add(biol_2042_lab) calendar.events.add(phys_1420) calendar.events.add(phys_1420_disc) calendar.events.add(phys_1440_lab) calendar.events.add(pubh_4050) # Save calendar to file calendar_file_path = "/mnt/data/class_schedule.ics" with open(calendar_file_path, 'w') as f: f.writelines(calendar.serialize_iter()) calendar_file_path
Leave a Comment