Python Exception Handling

Exception can be said to be any unusual condition in a project coming about to the disturbance in the stream of the system. At whatever point an exception happens the system ends the execution and in this way further code is not executed. Subsequently exception is that slip which python script is not able to handle with. Exception in a code can likewise be taken care of. On the off chance that it is not took care of, then the code is not executed further and subsequently execution stops when exception happens.

Chain of importance Of Exception

  • ZeroDivisionError: Occurs when a number is separated by zero.
  • NameError: It happens when a name is not found. It might be nearby or worldwide.
  • IndentationError: If mistaken space is given.
  • IOError: It happens when Input Output operation falls flat.
  • EOFError: It happens when end of document is come to but then operations are being performed

Exception Handling

The suspicious code can be taken care of by utilizing the attempt piece. Encase the code which raises an exception inside the attempt square. The attempt square is taken after with the exception of proclamation. It is then further taken after by articulations which are executed amid exception and in the event that if exception does not happen.