4
I have a table of 5 rows and 5 columns. For each column I have a name, for example: Name, Age, Gender, Weight, Height. And all cells 5*5 are filled.
I need the following formatting:
Idade
João - 15
José - 16
Maria - 21
Sexo
João - M
José - M
Maria - F
That is, for each cell information I need to show me which person this result is related to.
I already list the title (Age) and the value (16), but I can not link the name to each information, getting:
Nome
JOão
JOsé
MAria
Idade
16
15
21
Sexo
M
M
F
I created a variable by receiving the value of the cell(x,y), but prints empty. Follows my code:
for crange in sheet.merged_cells:
rlo, rhi, clo, chi = crange
rranges[(clo,rlo)] = rhi - rlo;
for col_index in range(sheet.ncols):
linhas = iter(range(sheet.nrows));
nome_mol = ""
for row_index in linhas:
if (sheet.cell_value(row_index,col_index) != ''):
valor = sheet.cell_value(row_index,col_index);
if (sheet.cell_value(row_index,col_index) == "NOME"):
nome_mol = sheet.cell_value(row_index,col_index)
print "{} -- {} |{} |".format(nome_mol, valor)
Thank you so much for the explanation, I hope I can get this logic as soon as possible. It worked. Thank you
– Mary Tortugo