from docx import Document标签:word,表格,python,doc,param,column,path,table From: https://www.cnblogs.com/guofeng-1016/p/18001631
from docx.shared import Cm
def delete_columns(path, table_n, column_n):
"""
删除一列
:param path: 路径
:param table_n: 第几个表格
:param column_n: 第几列
:return:
"""
doc = Document(path)
print(doc)
# 定位表格
print(doc.tables[table_n])
table = doc.tables[table_n]
column = table.columns[column_n]
for cell in column.cells:
cell._element.getparent().remove(cell._element)
doc.save(path)
path = r'''cc.docx'''
delete_columns(path, 0, 2)