#coding:utf-8 import os import win32com from win32com.client import Dispatch,constants from docx import Document #def getTbl def parse_docx(f,title): d = Document(f) for t in d.tables: ‘‘‘获取需要的表‘‘‘ tbTitle = t.cell(0, 0).text if title == tbTitle: columnLen = len(t.columns) for i in range(0,columnLen): for row in t.rows: print(row.cells[i].text) print("------------") #print(t.cell(0, 0).text) #t = d.tables[10] #print(t) #print(t.cell(0,0).text) if __name__ == "__main__": f = "123.docx" parse_docx(f,"内科")