exception

Less than 1 minute

exception

捕获

except xxx的不是对象except Excepton(), 而是类名except Exception.

### all exception
try:
    ...
except Exception as e:
    raise e

### some standard exception
try:
    ...
except AttributeError:
    ...

### custom exception
class MyException(Exception):
    def __init__:
        pass

raise

raise Exception('dddddddd')

else_finally

try<语句块1>
except<语句块2>
else:
    # Execute without exception
finally:
    # Execute with or without exception