-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
38 lines (33 loc) · 1.08 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import datetime
import os
import re
#chage to the dir
print(os.getcwd())
os.chdir("C:/Users/Hazcoper/Desktop/getAulas")
# get the day of the week
# get the time
today = datetime.datetime.now()
day = today.strftime("%w")
hour = today.strftime("%H")
minute = today.strftime("%M")
main_link = ""
#open the file and read line by line
with open("link_aulas.txt", "r") as file:
line = file.readline()
data = re.split(',|;', line)
while(line != ""):
line = file.readline() #readline
data1 = re.split(',|;', line) # parse line
if len(data1) < 2:
break #discard empty line
if data1[2] == day:
if data[2] != day:
data = data1 # means the first class is trash so I wil; change it and move one
elif abs(int(data1[3].split("h")[0]) - int(hour)) < abs(int(data[3].split("h")[0]) - int(hour)):
#this is closer to the time then the one I have so change class
data = data1
print(f"""
Aula : {data[1]}
Horario : {data[3]}
{data[0]}
""")