用python-docx将Word中的表格转化为二维列表
from docx import Document
doc = Document('template.docx')
all_tables = doc.tables
for table in all_tables:
# 将表格内容转化为二维列表 row*col 如果去掉第一行标题可用rows[1:]
list = [[cell.text for cell in row
用python-docx将Word中的表格转化为二维列表
from docx import Document
doc = Document('template.docx')
all_tables = doc.tables
for table in all_tables:
# 将表格内容转化为二维列表 row*col 如果去掉第一行标题可用rows[1:]
list = [[cell.text for cell in row