提取幻灯片文本
提取幻灯片文本
from pptx import Presentation
prs = Presentation("deck.pptx")
for i, slide in enumerate(prs.slides, 1):
for shape in slide.shapes:
if shape.has_text_frame and shape.text_frame.text.strip():
print(i, shape.text_frame.text[:80])
if slide.has_notes_slide:
print("备注", slide.notes_slide.notes_text_frame.text[:80])一页幻灯片作为一个切片通常语义完整;超长页面再按文本框分组切分。