我在我的python脚本中有这个
form = cgi.FieldStorage()
print form
print form.getvalue("param")
第二行打印FieldStorage(None, None, 'param=abcd')
,第三行导致错误
File "/var/www/cgi-bin/use_save.py", line 24, in <module>
print form.getvalue("param")
File "/usr/lib64/python2.7/cgi.py", line 548, in getvalue
if key in self:
File "/usr/lib64/python2.7/cgi.py", line 594, in __contains__
raise TypeError, "not indexable"
TypeError: not indexable
导致此错误的原因是只传递一个字符串的值?
答案 0 :(得分:0)
尝试将表单的enctype
更改为multipart/form-data
或application/x-www-form-urlencoded
。
此处提供更多信息:http://www.futurequest.net/forums/showthread.php?t=14245