def cells_all_junk(cells, is_rubbish=None):
"""\
Return True if all cells in the sequence are junk.
What qualifies as junk:
-- empty cell
-- blank cell
-- zero-length text
-- text is all whitespace
-- number cell and is 0.0
-- text cell and is_rubbish(cell.value) returns True.
"""
for cell in cells:
if cell.ctype in null_cell_types:
continue
if cell.ctype == XL_CELL_TEXT:
if not cell.value:
continue
if cell.value.isspace():
continue
if cell.ctype == XL_CELL_NUMBER:
if not cell.value:
continue
if is_rubbish is not None and is_rubbish(cell):
continue
return False
return True
评论列表
文章目录