尝试除了IndentationError

Chr*_*eta 4 python shell exception

我的缩进有什么问题?

>>> try:
        print("Hello World!")
    except:

  File "<pyshell#2>", line 3
    except:
          ^
IndentationError: unindent does not match any outer indentation level
Run Code Online (Sandbox Code Playgroud)

使用IDLE Python 2.7.2,Shell; 在try语句之后,我尝试退格到正确的缩进,但它转到左边距,我必须键入4个空格.

sim*_*izz 7

这里不需要任何缩进,"except"语句必须位于顶层(与try语句相同).


joa*_*uin 5

>>> try:
    print("hello")
except:
    pass

hello
>>> 
Run Code Online (Sandbox Code Playgroud)