【发布时间】:2015-03-13 11:50:59
【问题描述】:
如何在使用 catdoc 将 .doc 文件转换为 .txt 文件时接受音轨更改?
假设有两个文件'original.doc'和'modified.doc'。
'original.doc'有以下句子:this a test sentence
'modified.doc' 有以下句子:this is a test statement
当我将 modified.doc 转换为 .txt 文件而不是得到 this is a test statement 时,我得到的是 this is a test sentence statement
我正在使用下面的代码。
def doc_to_text_catdoc(filename):
(fi, fo, fe) = os.popen3('catdoc -w "%s"' % filename)
fi.close()
retval = fo.read()
erroroutput = fe.read()
fo.close()
fe.close()
if not erroroutput:
return retval
else:
raise OSError("Executing the command caused an error: %s" % erroroutput)
【问题讨论】: