Exception Handling in Python


Exception Handling

 What is Error ?
  • When python parser unable to understand the developer given code, so it raise error.
  • If programmer is not following coding guidelines or language dependent syntax, error occurs.
  • Syntax errors are nothing but parsing error. 
  • If any error occurs, code will not compile and throw syntax error of linker error.

What is Exception ?

  • Errors at run time are called exceptions.
  • If any  exception occurs, program will terminate abnormally.
  • If user is not providing proper input, we have a chance to get exception.


Exception handling

It is a mechanism or process to avoid abnormal termination of application.
  • try and except
  • try with else
  • try with finally

Raising Exception Manually

raise is a keyword used to throw / return exception forcefully by a developer.

>>>>>





My photo
Techno Xpresss
Bangalore, Karnataka, India