Fix method writing dt examples to file

Method wasn't removing trailing new line chars.
This commit is contained in:
Michał Czekański 2020-05-24 18:48:30 +02:00
parent f73ae6290f
commit f025df0381

View File

@ -23,10 +23,12 @@ class ExamplesManager:
lineNum = 0 lineNum = 0
while True: while True:
line = file.readline() line: str = file.readline()
if line == "": if line == "":
break break
lineNum += 1 lineNum += 1
line = line.rstrip('\n')
words = line.split("|") words = line.split("|")
if len(words) != 7: if len(words) != 7:
@ -133,7 +135,7 @@ class ExamplesManager:
example: SurvivalDTExample example: SurvivalDTExample
for example in examplesToAdd: for example in examplesToAdd:
strToWrite = "\n{}|{}|{}|{}|{}|{}|{}".format(example.classification.name, strToWrite = "{}|{}|{}|{}|{}|{}|{}\n".format(example.classification.name,
example.hungerVal.name, example.hungerVal.name,
example.thirstVal.name, example.thirstVal.name,
example.staminaVal.name, example.staminaVal.name,