Python :Dive Into Python 中文版 读后感_第六章__异常捕捉

语法:

1 try:
2     pass
3 except  Error:
4     pass
5 else:
6     raise exception
7 finally:
8     pass

1. 如果try里面没有异常,else里面的代码就会运行.

2. finally的代码一定会运行,无论有没异常发生

3. 引发 异常的关键字为raise

原文地址:https://www.cnblogs.com/lanxue/p/2621438.html