Python: “try-except-else” Usage Explained!

In this article, let us learn about the “try-except-else” mechanism in Python. For those of you in a hurry here is the short version of the answer. “try-except-else”: In a Nutshell The try-except-else is a set of statements provided by Python to handle exceptions. They each have a role and function as described in the … Read more

Python: How to Create a Custom Exception

In this article, let us learn how to create a custom exception in Python with a help of a few examples. For those of you in a hurry here is the short version of the answer. Custom Exception Creation: The Recipe To create a custom exception, you simply have to define and create a class … Read more

TypeError: A Step By Step Troubleshooting Guide!

In this article, we’ll look at TypeError in Python, what are its causes, and how to fix them. Troubleshooting any errors will include the following steps Let us start by understanding the TypeError and its causes! Understanding TypeError and its Causes Instead of starting off with a definition, let’s take a look at an example! … Read more

Python: Catch Exception and Print

In this article, let us see how to catch an exception and print it instead of letting our programs crash with an error! For those of you in a hurry here is the short version of the answer. Short Version of the Answer We can catch and print an exception by using the try-except block. … Read more

Python: Print StackTrace on Exception!

In this article we’ll be looking at printing just the StackTrace from the error message of an exception. We’ll see how to print it to the output screen and how to save it to a file. We will also see how to customize the message further for maximum efficiency. Without further ado, let’s begin! For … Read more