from docx import Document word=Document(',,,,,,.docx') paragraphs=word.paragraphs #返回一個列表,有多少段就有多少個值 for i in paragraphs: print(i.text) #列印每段內容 a=para ...
from docx import Document
word=Document(',,,,,,.docx')
paragraphs=word.paragraphs #返回一個列表,有多少段就有多少個值
for i in paragraphs:
print(i.text) #列印每段內容
a=paragraphs[0]
for j in a.runs: #列印這一段所有的文字塊
print(j.text)