python的try方法中的else和finally的区别

try:
 <body>
except <ExceptionType1>:
    <handler1>
...
except <ExceptionTypeN>:
    <handlerN>
except:
    <handlerExcept>
else:
    <process_else>
finally:
    <process_finally>

# else执行的条件是try能够正常执行
# finally是一定会执行

无论try是否发生异常,finally总会执行
try无异常,才会执行else

原文地址:https://www.cnblogs.com/emanlee/p/15405282.html