Created
June 7, 2019 17:25
-
-
Save cyyself/88b80ea82bc2fcac193b5161f572c793 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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