我想做这个:
while list:
for blah in blah:
things
list.remove(min(list))
这个循环直到列表中的所有项目都被删除吗?因为我有我的代码,它只是循环 [list] 次,然后从函数返回。我需要一个循环,直到列表中的所有项目都消失为止。
我应该注意,在最后一次迭代之前,中间没有任何东西(在 for 循环中)被处理。
根据要求,整个算法在运行时:
def parsexlsx(address):
bits = []
i = 0
while address:
min_address = False
for row in ws.iter_rows(row_offset=4,column_offset=3):
c = row[2]
d = row[3]
if not d.internal_value:
if min_address: #we set it to true, then kept going until blank row
break #bits is what you want it to be now
bits = [] #reset bits every time we hit a new row
continue #this will just skip to next row
for bits_cell in row[4:]:
if bits_cell.internal_value:
bits.append(bits_cell.internal_value)
if c.internal_value:
if c.internal_value == min(address):
min_address = True
address.remove(min(address))
print bits
return bits