from docx import Document w=Document(r'F:\word練習\表格.docx') table_1=w.tables[0] #洗掉行 print(len(table_1.rows)) row2=table_1.rows[1] row2._element.getparent().remove(row2._element) print(len(table_1.rows)) #洗掉列 col=table_1.table.columns[1] for cell in col.cells: cell._element.getparent().remove(cell._element) w.save(r'F:\word練習\洗掉表格的行或者列.docx')
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/98277.html
標籤:Python
上一篇:pygame 的聲音播放
下一篇:洗掉表
