Advertisement

Exception-Handling in Python || Understand with simple example || All About Python

Exception-Handling in Python || Understand with simple example || All About Python In this tutorial you will learn how to handle exceptions in Python.

When writing a program, many things can go wrong. Sometimes these errors are your mistake in the code, other times, they are unavoidable, yet potentially harmful. In simple words, errors are something which Python doesn't like and will show its displeasure on by abruptly terminating the program.

Errors can be of two types:
1.Syntax errors
2.Errors which are encountered at runtime (Exceptions)

Exceptions occur during run-time. Your code may be syntactically correct but it may happen that during run-time Python encounters something which it can't handle, then it raises an exception. For example, dividing a number by zero or trying to write to a file which is read-only.

When a Python script raises exception, it creates an Exception object. If the script doesn't handle exception the program will terminate abruptly.

#python
#exception_handling
#crazytechlearner

what is exception handling in python,exception handling in python hindi,exception handling in python example,exception handling in python 3,exception handling in python in hindi,exception handling in python,

Post a Comment

0 Comments