尝试在 WinPython/Spyder 中使用 PyPDF2 时,我无法解释错误消息
错误信息:
在[3]中: runfile('C:/Users/User/Downloads/WPy64-3720/pdf2text.py', wdir='C:/Users/User/Downloads/WPy64-3720')
Code:
import PyPDF2
path="C:\\Users\User\Downloads\WPy64-3720\soln.pdf"
text="C:\\Users\User\Downloads\WPy64-3720\Soln.text"
pdf_file = open(path, 'rb')
text =""
read_pdf = PyPDF2.PdfFileReader(pdf_file)
c = read_pdf.numPages
for i in range(c):
page = read_pdf.getPage(i)
text+=(page.extractText())
(Spyder 维护者在这里) 这不是错误消息。runfile
是 Spyder 用于在 IPython 控制台中运行代码的命令。
如果您没有看到其他任何内容,是因为您没有在代码中打印任何内容。例如,将此行添加到您的代码中
print('Hello world!')
将显示一个Hello world
印在下面runfile
.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)