Add parseComments argument to readList

This commit is contained in:
Fierelier 2022-12-20 23:58:50 +01:00
parent 2443494ac0
commit 88ae0029d6
2 changed files with 4 additions and 2 deletions

View File

@ -19,13 +19,14 @@ def findAll(path,method = os.path.isfile):
if method(fp): rtn.append(fp)
return rtn
def readList(path):
def readList(path,parseComments = True):
with open(path,encoding="utf-8") as f:
content = f.read().replace("\r","").strip("\n").split("\n")
index = 0
length = len(content)
while index < length:
line = content[index]
if parseComments: line = line.split("#",1)[0]
line.strip("\t ")
if line == "":
del content[index]

View File

@ -1 +1,2 @@
userModules
userModules
#title