ignore empty lines, ignore missing files
This commit is contained in:
parent
f9716f9e9f
commit
9b1ef1a655
@ -48,9 +48,15 @@ def SameScore(a, b):
|
||||
|
||||
def LoadRecordsFromFile(path):
|
||||
records = []
|
||||
with open(path, "r") as f:
|
||||
for line in f.readlines():
|
||||
records.append(ParseScore(line.strip()))
|
||||
try:
|
||||
with open(path, "r") as f:
|
||||
for line in f.readlines():
|
||||
line = line.strip()
|
||||
if line != "":
|
||||
records.append(ParseScore(line))
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
return records
|
||||
|
||||
def AddScore(records, score):
|
||||
|
Loading…
Reference in New Issue
Block a user