为了账号安全,请及时绑定邮箱和手机立即绑定

python导入模块有点问题

python导入模块有点问题

伊里野的天空111 2017-08-07 17:45:19
import fnmatchimport osimport sys import win32com.client  readpath=r'D:\123'    wordapp = win32com.client.gencache.EnsureDispatch("Word.Application")  try:      for path, dirs, files in os.walk(readpath):          for filename in files:              if not fnmatch.fnmatch(filename, '*.docx'):continue              doc = os.path.abspath(os.path.join(path,filename))              print 'processing %s...' % doc              wordapp.Documents.Open(doc)              docastext = doc[:-4] + 'txt'              wordapp.ActiveDocument.SaveAs(docastext,FileFormat=win32com.client.constants.wdFormatText)              wordapp.ActiveDocument.Close()  finally:      wordapp.Quit()      print 'end'    f=open(r'd:\123\test.txt','r')  for line in f.readlines():      print line.decode('gbk')  f.close()SyntaxError: multiple statements found while compiling a single statement
查看完整描述

目前暂无任何回答

  • 0 回答
  • 0 关注
  • 1385 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信