Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python &引用;“输入小数”;引起错误_Python_Module_Decimal_Pypdf - Fatal编程技术网

Python &引用;“输入小数”;引起错误

Python &引用;“输入小数”;引起错误,python,module,decimal,pypdf,Python,Module,Decimal,Pypdf,这是我正在使用的代码 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(inpu

这是我正在使用的代码

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
现在,当我运行此代码时,我得到一个错误: 模块“对象”没有属性“编号”

我拍下了我得到的全部输出的截图 当我运行上面的代码时,出现了错误和所有问题。 那么,请看一看,让我知道出了什么问题


这是一个打印输出,包含所有不可被3整除的50以内的数字。它可能位于
sys.path
上的
numbers
模块中,该模块隐藏着标准库
numbers
。看看它在哪里:

import numbers
print numbers.__file__

正如我之前所说的,(看起来)你的十进制模块坏了……那么,我应该怎么解决这个问题呢?有没有办法得到一个新的十进制模块?我不知道。。。试试这个:
导入数字;打印数字。数字
如果您得到一个
属性错误:“module”对象没有属性“Number”
,那么问题是数字模块..哇!这起作用了。我之前为解决一个练习创建了一个数字文件,似乎调用的是这个文件而不是数字模块。我更改了数字文件的名称,现在它工作正常。非常感谢你。