Exception trapping
Exception types :
SystemExit : The interpreter requests exit
Keyboardinterrupt: User interrupt execution
GeneratorExit: generator (generator) An exception occurs to notify the exit
Exception: Base class of generic type
```
try:
pass
# Code that may go wrong
except:
pass
# at that time try When there is an error in the code execution , Will execute exept The code in , You can handle exceptions here
else:
pass
#try There are no errors in the code execution in , Will perform else The code in
finally:
pass
#try No matter what goes wrong ,finally All the code in
```
```
try:
pass
# Code that could go wrong
except Exception types as e:
pass
```
assert Assertion :
assert Expected results == The actual result
raise: Actively throw an exception