我不確定為什麼我們在 try...except...finally
語句中需要 finally
。在我看來,這個代碼塊
try: run_code1() except TypeError: run_code2() other_code()
和這個使用finally
:
try: run_code1() except TypeError: run_code2() finally: other_code()
我錯過了什麼嗎?
我不確定為什麼我們在 try...except...finally
語句中需要 finally
。在我看來,這個代碼塊
try: run_code1() except TypeError: run_code2() other_code()
和這個使用finally
:
try: run_code1() except TypeError: run_code2() finally: other_code()
我錯過了什麼嗎?