【问题标题】:AttributeError: 'module' object has no attribute 'Fieldstorage'AttributeError:“模块”对象没有属性“字段存储”
【发布时间】:2016-07-30 04:10:01
【问题描述】:

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

Traceback(最近一次调用最后一次): 文件“/Users/Andrew/Desktop/password.py”,第 2 行,在 形式 = cgi.Fieldstorage() AttributeError: 'module' 对象没有属性 '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>"

【问题讨论】:

    标签: python


    【解决方案1】:

    FieldStorage 应大写S

    【讨论】:

    • 谢谢你,我的菜鸟错误
    猜你喜欢
    • 2021-01-28
    • 1970-01-01
    • 1970-01-01
    • 2010-11-18
    相关资源
    最近更新 更多