when i run a try except statement to catch a IndentationError ,the statement doesn't work , this is my code:
try:
for i in range(2):
print(i)
except IndentationError:
print('IndentationError')
then i got the result:
try:
for i in range(2):
print(i)
except IndentationError:
print('IndentationError')
File "<ipython-input-57-5df0f4cccb57>", line 3
print(i)
^
IndentationError: expected an indented block```
why the try except statement doesn't work in this situation ?