4
這裏是我使用「進口十進制」引發錯誤
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
現在的代碼,當我運行這段代碼我得到一個錯誤: 模塊「對象」有沒有屬性「數」
當我運行上面的代碼時,我得到了一個輸出結果的屏幕截圖,其中包含錯誤和所有內容。所以,請看看,讓我知道有什麼不對?
正如我以前說過的,(似乎)你的小數模塊壞了.. – pradyunsg 2013-03-12 06:59:41
很好,所以我應該怎麼做才能解決這個問題? 有沒有辦法有一個新的十進制模塊? – faraz 2013-03-12 07:07:40
我不知道...試試這個:'輸入數字;打印numbers.Number'如果你得到一個'AttributeError:'模塊'對象沒有'數字'屬性,那麼問題是數字模塊.. – pradyunsg 2013-03-12 07:15:00