私はこれをしたい:
while list:
for blah in blah:
things
list.remove(min(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