beep
This commit is contained in:
parent
41faa54e45
commit
bdeef8224d
5 changed files with 469 additions and 0 deletions
27
AInvestigation/extract_best_intervals.py
Normal file
27
AInvestigation/extract_best_intervals.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
from datetime import datetime
|
||||
|
||||
with open(r'AInvestigation/data.txt', 'r') as input:
|
||||
lines = input.read().split('\n')[:-1]
|
||||
|
||||
day = 0
|
||||
|
||||
times = []
|
||||
|
||||
for line in lines:
|
||||
if line[0] == "=":
|
||||
day+=1
|
||||
times.append({})
|
||||
continue
|
||||
date,time,_,_,name,part = line.split()
|
||||
times[day-1][(name,part[1])] = datetime.strptime(date+" "+time,"%Y-%m-%d %H:%M:%S")
|
||||
|
||||
for num,day in enumerate(times):
|
||||
best = [datetime.strptime("23:59:59","%H:%M:%S")-datetime.strptime("00:00:01","%H:%M:%S"),""]
|
||||
for name,part in day.keys():
|
||||
if part == '2':
|
||||
diff = [day[name,'2'] - day[name,'1'],name]
|
||||
best = min(best,diff, key=lambda x:x[0])
|
||||
print("Best difference of day "+str(num+1)+": "+str(best[0])+" (by "+best[1]+")")
|
||||
|
||||
# print(times)
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue