首页 > 技术文章 > 读取ppt

energetic 2020-06-05 22:32 原文

from   pptx  import  Presentation

prs=Presentation('名字.pptx')

for  slide  in  prs.slides:    # 读取每一页幻灯片

  for   shape   in  slide.shapes:   #获取每一页的内容

    if   shape.has_text_frame:   #判断是否有文本框架

      text_frame=shape.text_frame

      for   paragraph   in   text_frame.paragraphs:

        print(paragraph.text)    #打印每一段的内容

    

推荐阅读