init
This commit is contained in:
@@ -4,10 +4,17 @@ sampleMode = False
|
||||
|
||||
def identifyDay(inputArgument):
|
||||
twoDigitsDay = '00'
|
||||
day = 0 if (inputArgument[inputArgument.rfind('/')+4:inputArgument.rfind('.')] == 'X') else inputArgument[inputArgument.rfind('/')+4:inputArgument.rfind('.')]
|
||||
day = 0 if (inputArgument[inputArgument.rfind('/')+4:inputArgument.rfind('.')] == 'XX') else inputArgument[inputArgument.rfind('/')+4:inputArgument.rfind('.')]
|
||||
twoDigitsDay = str(day).zfill(2)
|
||||
return twoDigitsDay
|
||||
|
||||
def identifyYear(inputArgument):
|
||||
inputArgument = inputArgument[:inputArgument.rfind('/')]
|
||||
inputArgument = inputArgument[inputArgument.rfind('/')+1:]
|
||||
year = int(inputArgument) if (inputArgument.isnumeric()) else 0
|
||||
fourDigitsYear = str(year).zfill(4)
|
||||
return fourDigitsYear
|
||||
|
||||
def setSampleMode(mode:bool):
|
||||
global sampleMode
|
||||
if (mode) : sampleMode = True
|
||||
@@ -23,11 +30,11 @@ def showSampleMode():
|
||||
print ("----------------------")
|
||||
return
|
||||
|
||||
def getPath2Data(aocDay):
|
||||
return './day'+str(aocDay)+'/'
|
||||
def getPath2Data(aocDay,aocYear):
|
||||
return './'+str(aocYear)+'/day'+str(aocDay)+'/'
|
||||
|
||||
def getFilename2Data(aocDay):
|
||||
dataFilename = 'sample.day'+str(aocDay) if ( sampleMode ) else 'data.day'+str(aocDay)
|
||||
dataFilename = 'sample.day'+str(aocDay) if ( sampleMode ) else 'input.day'+str(aocDay)
|
||||
return dataFilename
|
||||
|
||||
def readDataFile (path, filename):
|
||||
|
||||
Reference in New Issue
Block a user