【发布时间】:2019-07-11 20:21:14
【问题描述】:
当我尝试处理以下代码中的IndentatioError时..
try:
def Test():
print("Test Function")
except IndentationError:
print("Exception raised")
我在输出中收到此错误:
File "C:/Users/PycharmProjects/py1/Exception.py", line 3
print("Test Function")
^
IndentationError: expected an indented block
Process finished with exit code 1
我接受输出中的 except 部分。
我想知道如何处理这种类型的异常。
【问题讨论】:
-
你不处理它,你应该修复你的代码格式......见stackoverflow.com/questions/492387/…
标签: python python-3.x exception