I`am trying to extract some data from a sheet in excel 'recursos is the name of the page', I would like to not use the current for cycle any ideas?
celdas3=recursos['AN8':str(rsearch)+str(max_row)]
for c1,c2,c3,c4,c5,c6,c7,c8,c9,c10 in celdas3:
var_3=[c1.value,c2.value,c3.value,c4.value,c5.value,c6.value,c7.value,c8.value,c9.value,c10.value]
ex3.append(var_3)
print(ex3)
And I would like to instead of use c1,c2,c3, etc use a variable. celdas3 is:
Charlie Clark
19.7k4 gold badges56 silver badges64 bronze badges
1 Answer 1
You don't have to unpack the list in the for
loop:
for c in celdas3:
var_3 = [c1.value for c1 in c]
ex3.append(var_3)
print(ex3)
answered Dec 26, 2019 at 18:53
-
Thanks! It was the answer I was looking for,CVM– CVM2019年12月26日 19:08:17 +00:00Commented Dec 26, 2019 at 19:08
lang-py