“导入十进制”引发错误

2024-05-15 13:19:48 发布

您现在位置:Python中文网/ 问答频道 /正文

这是我使用的代码

import os
import decimal
from pyPdf import PdfFileReader
path = r"E:\python\Real Python\Real Python\Course materials\Chapter 8\Practice files"
inputFileName = os.path.join(path,"Pride and Prejudice.pdf")
inputFile = PdfFileReader(file(inputFileName,"rb"))

print "Number of pages:", inputFile.getNumPages()
print "Title:", inputFile.getDocumentInfo().title

现在,当我运行这段代码时,我得到一个错误: “object”模块没有“Number”属性

我把我得到的全部输出截图 当我运行上面的代码时,有错误和一切。 所以,请你看看,告诉我怎么了?在

enter image description here


Tags: path代码fromimportnumberos错误real
1条回答
网友
1楼 · 发布于 2024-05-15 13:19:48

这是所有不被3整除到50的数字的打印输出。它可能在sys.path上的numbers模块中,它隐藏了标准库numbers。查看位置:

import numbers
print numbers.__file__

相关问题 更多 >