生成不了pdf,运行也没报错
import os
from win32com.client import constants,gencache
def createpdf(wordPath, pdfPath):
word =gencache.EnsureDispatch('Word.Application')
doc = word.Documents.Open(wordPath, ReadOnly=1)
doc.ExportAsFixedFormat(pdfPath, constants.wdExportFormatPDF)
word.Quit()
createpdf('D:/jw/study/python/writeexcel/info.docx','D:/jw/study/python/writeexcel/info.pdf')