【发布时间】:2012-01-11 21:01:05
【问题描述】:
我似乎看不出这段代码有什么问题,但我在运行脚本时收到 IndentationError。
import web
import json
urls = (
'/(.*)', 'handleRequest'
)
app = web.application(urls, globals())
class handleRequest:
def GET(self, method_id):
if not method_id:
return json.dumps({'ok':0})
else:
return json.dumps({'ok': method_id})
def POST(self):
i = web.input()
pass
if __name__ == "__main__":
app.run()
这是我尝试运行脚本时收到的控制台错误消息:
>>> def POST(self):
File "<stdin>", line 1
def POST(self):
^
IndentationError: unexpected indent
>>> i = web.input()
File "<stdin>", line 1
i = web.input()
^
我已经检查了缩进 - 以及我在整个文件中使用的相同 4 个空格 - 我错过了什么吗?!
【问题讨论】:
标签: python