-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdataHelper.py
More file actions
18 lines (18 loc) · 814 Bytes
/
dataHelper.py
File metadata and controls
18 lines (18 loc) · 814 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from TXTConnector import TXTConnector
def replaceTasksWithGroup():
t = TXTConnector(None)
# read tasks and groups from file
tasks, groups = t.readTasksAndGroups()
# replace tasks with groups
# endTimes, endTasks = t.readEndTimesAndTasks()
with open(t.getEndFile(), "r") as f:
lines = f.readlines()
endTimes = [line.split(t.fileLineSeparator)[0] for line in lines]
endTasks = [line.split(t.fileLineSeparator)[1].replace("\n", "") for line in lines]
endGroups = [groups[tasks.index(task)] for task in endTasks]
# write new tasks to file
with open("endTest.txt", "w") as f:
for i in range(len(endTasks)):
f.write(endTimes[i]+t.fileLineSeparator+endGroups[i]+t.fileLineSeparator+endTasks[i]+"\n")
print("done")
replaceTasksWithGroup()