3 ms·
And the full form of a Python exception handling block is not try/except/finally. It's try/except/else/finally. The 'try' block contains code which might raise
by ubernostrum 8y ago
And the full form of a Python exception handling block is not try/except/finally. It's try/except/else/finally.
The 'try' block contains code which might raise an exception.
It can be followed by zero or more 'except' blocks, each of which indicates the type(s) of exception it will catch and contains code to execute in the event of that type of exception.
The 'except' block(s) can be followed by one 'else' block, which contains code to execute in the event no exception was raised by the code in the 'try' block.
And then there is optionally a 'finally' block, containing code that must be executed in all circumstances.