def lines(file):for line in file:yield lineyield '\n'def blocks(file):block=[]for line in lines(file):if line.strip():block.append(line)elif block:yield ''.join(block).strip()block=[]請(qǐng)問(wèn)下大蝦,上面的elif block中block列表為判斷條件是什么意思,什么情況下才執(zhí)行這個(gè)語(yǔ)句?還有下面的yield 代碼是啥意思呢?
- 2 回答
- 0 關(guān)注
- 1365 瀏覽
添加回答
舉報(bào)
0/150
提交
取消