Skip to content

Instantly share code, notes, and snippets.

@cyyself
Created June 7, 2019 17:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cyyself/88b80ea82bc2fcac193b5161f572c793 to your computer and use it in GitHub Desktop.
Save cyyself/88b80ea82bc2fcac193b5161f572c793 to your computer and use it in GitHub Desktop.
import os
import os.path
import win32com
import win32com.client
import time
def ppt2pptx(file):
powerpoint = win32com.client.Dispatch('PowerPoint.Application')
win32com.client.gencache.EnsureDispatch('PowerPoint.Application')
powerpoint.Visible = 1
ppt = powerpoint.Presentations.Open(file)
ppt.SaveAs(file[:-4]+'.pptx')
powerpoint.Quit()
path = 'C:\\Users\\cyy\\Desktop\\ppt\\王克金电子类6章\\'
for subPath in os.listdir(path):
s = os.path.join(path,subPath)
if (s.endswith('.ppt')):
print(s)
ppt2pptx(s)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment