AttributeError:'模块'对象没有属性' Fieldstorage'

时间:2016-04-08 19:01:21

标签: python

变得非常困惑。搜索周围但找不到任何有用的帮助。我收到了错误

追踪(最近一次通话):   File" /Users/Andrew/Desktop/password.py" ;,第2行,在     form = 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>"

1 个答案:

答案 0 :(得分:0)

FieldStorage应拼写为大写S