0

Possible Duplicate:
IndentationError: unindent does not match any outer indentation level

i wrote the following python code but i can't see what is the cause of the problem but i get the following error message:

def post(self): ^ IndentationError: unindent does not match any outer indentation level

class MainHandler(webapp2.RequestHandler):
def get(self):
    self.response.out.write(form)

def post(self):
    self.response.out.write("valid")

app = webapp2.WSGIApplication([('/', MainHandler)],debug=True)

any help will be appreciated

4

2 回答 2

2

Your code example is riddled with TAB characters. If you are mixing tabs with spaces, the error is almost a given.

Use the python tabnanny to clean up your source-code, switch your editor to use spaces only, then fix your indentations:

python -m tabnanny -v path/to/your/code.py
于 2012-08-01T10:37:23.353 回答
0

You've mixed up spaces and tabs. Run the script in python -tt to verify.

于 2012-08-01T10:37:22.923 回答