1

我开发了一个脚本,最终将使用 pdfminer 包将 .pdfs 转换为 .txt 文件。在准备主题文件以供使用时,我必须从 xlutils.copy 导入副本

从 xlutils.copy 导入副本,我遇到了来自与 copy.py 相关的 python 文件之一的语法错误(xlutils\filter.py 的第 699 行

def method(self,name,*args):
    if self.name:
        print repr(self.name),
    print "%s:%r"%(name,args)

语法错误光标指向“r”和左括号之间的 print repr(self.name) 区域。我发现直到 filter.py 脚本的第 825 行才定义repr 。

语法错误的确切原因可能是什么?他们有什么方法可以更正脚本以使 filter.py 不会触发 xlutils.copy 命令?

4

1 回答 1

0

在 python3 中,打印命令明显不同。特别是你不能说print x。你不得不说print(x)。见https://docs.python.org/3.0/whatsnew/3.0.html#print-is-a-function

于 2016-08-11T17:38:21.910 回答