Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

try except IndentationError

What is wrong with my indentation?

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

  File "<pyshell#2>", line 3
    except:
          ^
IndentationError: unindent does not match any outer indentation level

Using IDLE Python 2.7.2, Shell; after the try statements I attempt to backspace to the proper indentation but instead it goes to the left margin and I must type 4 spaces.

like image 995
Christopher Markieta Avatar asked Dec 07 '22 17:12

Christopher Markieta


1 Answers

Here no need any indentation, "except" statement must be at the top level (the same as try statement).

like image 86
simplylizz Avatar answered Dec 09 '22 16:12

simplylizz