首页 > 其他 > 详细

读取word段落和文字块

时间:2020-06-05 23:03:49      阅读:44      评论:0      收藏:0      [点我收藏+]

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段落和文字块

原文:https://www.cnblogs.com/energetic/p/13052451.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!