# building input with open('in.txt','r') as f: inp = f.read().splitlines(keepends=False) blueprints = [] for line in inp: tempA, tempB = line.split(' ore. Each clay robot costs ') oreBot = int(tempA[-1]) clayBot, tempC = tempB.split(' ore. Each obsidian robot costs ') clayBot = int(clayBot) tempC, tempD = tempC.split(' clay. Each geode robot costs ') obsidianBot = tuple(map(int, tempC.split(' ore and '))) tempA, tempB = tempD.split(' ore and ') tempB, _ = tempB.split(' obsidian') geodeBot = (int(tempA), int(tempB)) blueprints.append((oreBot, clayBot, obsidianBot, geodeBot)) for blueprint in blueprints: print(blueprint)