from docx import Document word=Document(r' ') tale=word.tables[0] #第一種洗掉單元格的方法 table.cell(0,0).text="" #第二種洗掉單元格的方法 paragraph=table.cell(0,1).paragraphs[0].text="" #洗掉一行 for cell in table.rows[0].cells: cell.text="" #洗掉一列 for cell in table.columns[0].cells: cell.text="" word.save(r' ')
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/96403.html
標籤:Python
