2016-04-08 136 views
1

變得非常困惑。搜索周圍,但找不到任何有用的幫助。我得到的錯誤AttributeError:'模塊'對象沒有屬性'Fieldstorage'

回溯(最近通話最後一個): 文件 「/Users/Andrew/Desktop/password.py」,2號線,在 形式= cgi.Fieldstorage() AttributeError的: '模塊' 對象有沒有屬性 '的FieldStorage'

import cgi 
form = cgi.Fieldstorage() 

print """Content-type: text/html 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html><head> 
<title>Lab 10</title> 
</head><body> 
""" 

password = form.getvalue("password") 
if password=="12345": 
    print "<p>Password correct.</p>" 

else: 
    print "<p>Sorry, try again.</p>" 

print "</body>" 
print "</html>" 

回答

0

FieldStorage應該以大寫S拼寫。

+0

謝謝,我的部分菜鳥錯誤 – aaandrewp

相關問題