读取ppt

 1 from   pptx  import  Presentation
 2 
 3 prs=Presentation('名字.pptx')
 4 
 5 for  slide  in  prs.slides:    # 读取每一页幻灯片
 6 
 7   for   shape   in  slide.shapes:   #获取每一页的内容
 8 
 9     if   shape.has_text_frame:   #判断是否有文本框架
10 
11       text_frame=shape.text_frame
12 
13       for   paragraph   in   text_frame.paragraphs:
14 
15         print(paragraph.text)    #打印每一段的内容

 

posted @ 2020-06-09 20:24  马蹄哒哒  阅读(89)  评论(0编辑  收藏  举报