读取word段落和文字块
Posted energetic
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了读取word段落和文字块相关的知识,希望对你有一定的参考价值。
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)
以上是关于读取word段落和文字块的主要内容,如果未能解决你的问题,请参考以下文章