#!"C:\Program Files (x86)\Ampps\python\python.exe"
import os,sys,cgi
print "Content-Type: text/plain;charset=utf-8"
form = cgi.FieldStorage()
json = form.getvalue("json")
file = open("testjson.json", "w")
file.write(json)
file.close()
print json
sys.exit()
我正在运行Python 2.7.2作为WSGI,其他脚本似乎可以工作。
答案 0 :(得分:1)
最后一个HTTP标头后面应该是空行。 (标题和正文应用空行分隔)
print "Content-Type: text/plain;charset=utf-8"
print # <---- Add this line
...
# sys.exit() <--- This is not needed.