import os BASE_PATH = os.path.dirname(os.path.dirname(__file__)) INPUTS_PATH = os.path.join(BASE_PATH, 'inputs') def getInputLineAsArray(day, return_type=None, test=False): """ get input for day x as array, each line representing one array entry when type is given, each entry will be converted to the specified type """ if test: file = os.path.join(INPUTS_PATH, str(day) + "_test") else: file = os.path.join(INPUTS_PATH, str(day)) with open(file, "r") as f: input_array = f.readlines() if return_type: return [return_type(i) for i in input_array] else: return input_array