class WorkSheet: def __init__(self, value1, value2, value3): self.vector = [value1, value2, value3]; myArray=[] for i in range(5): myArray.append(WorkSheet("Hola", "Que", "Tal")) for i in range(5): print(myArray[i].vector) print(myArray[3].vector[2]) class Indexado(): def __init__(self): self.data = [5,6,7,8,9,10] def __getitem__(self, item): if isinstance(item, int): print("index: ", item) return self.data[item] else: print("slice: ", item) return self.data[item] def __setitem__(self, key, value): self.data[key] = value vector = Indexado() print("primer elemento del vector: ", vector[0]) vector[0] = 50 print("los tres primeros elementos del vector: ", vector[0:4]) class Coche(): def __init__(self, marchas): self.marchas = marchas mondeo = Coche(["R","primera","segunda","tercera","directa"]) mondeo.marchas[4] class Persona(): def __init__(self, nombre, apellido): self.persona = [nombre, apellido] juan = Persona('Juan', 'Perez') #print(juan[0]) # da error: 'Persona' object is not subscriptable juan.persona[0] # Otra versiĆ³n incompleta class Hoja: def __init__(self, nombre_hoja, permutaciones, algoritmo): self.hoja = [nombre_hoja, permutaciones, algoritmo] n = 10 matriz = [] for i in range(n): # i+1 es la hoja en la que estoy p = permutations(list(range(1, i+2))) lista_permutaciones = [list(j) for j in p] algo = "algoritmo" matriz.append(Hoja("Sheet"+str(i+1), lista_permutaciones, algo)) print(matriz[i].hoja) ws = wb["Sheet"+str(i+1)] # accediendo a la hoja i+1 ws['E10'] = "Permutaciones" for k in range(i): #wb = openpyxl.load_workbook('pru.xlsx') #for i in range(n): # ws = wb[matriz[i][0]] # print(ws) wb.save('pru.xlsx')