是否可以捕获数据并将其放在列表变量中?不像变量args
get_row = Instant.getRowCount(self, "..\\TestData\\TestData.xlsx", "TestData")
for o in range(get_row):
boom = Instant.readDataFile(self, "..\\TestData\\TestData.xlsx", "TestData", o + 1, 5)
if not boom is None:
print(o) # The number produce here are the one i need
# I want to get all values in 'o'after the loop is done like variable = [{o}]
实际结果是:1,14,26
我想把这个值传递给另一个循环
谢谢你们。对不起
已编辑:尝试添加到列表,然后将其追加,但只产生1个数字“26”
get_row = Instant.getRowCount(self, "..\\TestData\\TestData.xlsx", "TestData")
for o in range(get_row):
boom = Instant.readDataFile(self, "..\\TestData\\TestData.xlsx", "TestData", o + 1, 5)
if not boom is None:
# print(o) # The number produce here are the one i need
my_list = list()
my_list.append(o)
print(my_list)
print(new_list)
输出文件是[26]
我创建了一个局部变量,然后将其附加到循环中。我的坏习惯是在循环中创建它。它将替换其中的所有值,这就是它打印最后一个数字的原因
相关问题 更多 >
编程相关推荐