0
Python 3.5.1でIndentationError
がスローされ、SyntaxError
がスローされることがあるので、どちらの場合でもIndentationError
を投げると思っています。例えば:その行は、それがされている必要があり以上のインデントされたためPython IndentationErrorとSyntaxErrorを理解する
1)
>>> if True:
... pass
... else:
File "<stdin>", line 3
else:
^
IndentationError: unexpected indent
2)
>>> if True:
... pass
... else:
File "<stdin>", line 3
else:
^
SyntaxError: invalid syntax