Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
hgeo = open("honorsgemoetry.txt","w+")
hp2 = open("honorsphysics2.txt","w+")
hp4 = open("honorsphysics4.txt","w+")
ip = open("introphysics.txt","w+")
data = open("Schedule.txt","r")
from itertools import islice
event_count = 0
with open("Schedule.txt") as f1:
header = list(islice(f1,7))
for l in header:
hgeo.write(l)
hp2.write(l)
hp4.write(l)
ip.write(l)
for l in f1:
print(l)
if "BEGIN:VEVENT" in l:
print("found event")
event_count += 1
event_lines = list(islice(f1, 7))
if "Physics-5" in event_lines[2]:
ip.write("BEGIN:VEVENT"+ "\n")
for l in event_lines:
ip.write(l)
elif "H. Physics-2" in event_lines[2]:
hp2.write("BEGIN:VEVENT"+ "\n")
for l in event_lines:
hp2.write(l)
elif "H. Physics-4" in event_lines[2]:
hp4.write("BEGIN:VEVENT"+ "\n")
for l in event_lines:
hp4.write(l)
elif "Geometry" in event_lines[2]:
hgeo.write("BEGIN:VEVENT"+ "\n")
for l in event_lines:
hgeo.write(l)
hgeo.write("END:VCALENDAR\n")
hp2.write("END:VCALENDAR\n")
hp4.write("END:VCALENDAR\n")
ip.write("END:VCALENDAR\n")
#process(event_lines)
print(event_count)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.