Standard Exceptions In Python
In this tutorial, we will learn the Standard Exceptions in Python. Basically here we learn about the types of Errors that have been rising due to our improper code. If we understand with this then we will correct or understand with the Errors that might be generated in our compiler.
List of Standard Exceptions in Python with description
Now we have to see the types of errors. Here we have listed some Important type of Exceptions with their description:
- StopIteration : It raised when the next() method in iterator does not point to any object or we can say when the number of items is not present in the container for the next() method.
- SystemExit : This is raised when the sys.exit() function does not use carefully or fails to work.
- FloatingPointError : It raised when the calculation involves floating-point fails.
- ZeroDivisonError : This raised when we divide the number by zero.
- AssertionError : raised when the Assert statement fails.
- ImportError : Raised if the import statement fails.
- IndexError: Raised if the index is not found in the given sequence.
- KeyError : Raised if the specified key appears to be not found in the given dictionary.
- IndentationError : When we don’t provide the proper indentation.
- TypeError : Raised when we give the wrong input to the program like an integer in place of a name.
- ValueError : Raised when we provide the invalid values to the argument that specified to the built-in function.
- RuntimeError: This error raised when the generated error does not fall into any type of category.
- KeyboardInterrupt : When we run our code and by mistake, we press the wrong key then this error is raised.
- UnboundLocalError : This error is raised when we want to access the local variable that we have created but we have to forget to assign value to it.
- SyntaxError : When the written code does not according to the python syntax then this error is raised.
- SystemError: This error is raised when the interpreter finds some system-related problems.
- ModuleNotFoundError: It raised when the import statements unable to load the specified module.
- RecursionError: It raised when the recursion depth exceeds its limiting value.
- ReferenceError: This raised when the generated error does not fall in any of the categories.
- TabError : Raised when the given indentation contains some extra or unwanted tabs and spaces.
Thanks for reading. For more information about Python you can visit the following links: