Below is the code which returns a print out of 8 figures:
for i in range(A,A 30):
for j in range(6,7):
if "X" in str(sh1.cell(i,j).value):
print(i)
Commandline Output:
44
55
57
61
65
69
71
72
How can I store these entities in their order in a single list like this:
["44", "55", "57", "61", "65", "69", "71", "72"]
CodePudding user response:
I suppose you want to create a new list
and add the items to it:
values = []
for i in range(A,A 30):
for j in range(6,7):
if "X" in str(sh1.cell(i,j).value):
print(i)
values.append(str(i))
values == ["44", "55", "57", "61", "65", "69", "71", "72"]
Getting familiar with list
s (and other basic python data structures) can get very handy: https://docs.python.org/3/tutorial/datastructures.html#more-on-lists