import decimal" 报错
这是我正在使用的代码:
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'
我截了一张运行这段代码后输出的完整截图,包括错误信息。请看看,告诉我哪里出问题了?
1 个回答
13
这是一个打印出所有不被3整除的数字,范围是到50。可能是在一个叫做numbers
的模块里,这个模块在sys.path
上,覆盖了标准库里的numbers
模块。你可以查看一下它的位置:
import numbers
print numbers.__file__