Skip to content

Instantly share code, notes, and snippets.

@prashant-shahi
Created December 18, 2018 18:13
Show Gist options
  • Select an option

  • Save prashant-shahi/aacfccbcd3f8ab64d0e3b092fae63dcf to your computer and use it in GitHub Desktop.

Select an option

Save prashant-shahi/aacfccbcd3f8ab64d0e3b092fae63dcf to your computer and use it in GitHub Desktop.
PPTX to text extractor using pptx-python package
import sys
from pptx import Presentation
if len(sys.argv) > 1:
prs = Presentation(sys.argv[1])
else:
exit("Error: Add pptx file in next argument")
for slide in prs.slides:
for shape in slide.shapes:
if not shape.has_text_frame:
continue
for paragraph in shape.text_frame.paragraphs:
for run in paragraph.runs:
print run.text
print '\n'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment