f = open("file"); s = f.read(); f.close(); splitted = s.split("\n\n"); default = splitted[0]; instructions = splitted[1]; resplitted = default.split("\n") for i in range (len(resplitted) - 1): letter = False; for y in range (len(resplitted[i] - 1)): if (resplitted[i][y] == '['): letter = True; elif (letter): letter = False; tab[i ]