Skip to Content

Python: “except KeyError” code Explained!

In this article let us learn what KeyError exceptions are, why they occur, how to prevent them from occurring and if they still occur then what are the crucial information we need to log for future debugging and how to log this information. In our journey to become a Proficient Python craftsman, we need to …

Read More about Python: “except KeyError” code Explained!

Python: Printing Exception (Error Message)

In this article, let us learn about printing error messages from Exceptions with the help of 5 specifically chosen examples. I have divided this article into 2 major sections Printing custom error messages and Printing a specific part of the default error message. By “default error message“, I mean the error message that you typically …

Read More about Python: Printing Exception (Error Message)

Python catch multiple exceptions

To improve our craftsmanship as a Python programmer, we need to learn about handling exceptions effectively. One of the tricks to improving our efficiency while handle exceptions is to catch several exceptions using a single except clause. Python provides us with several ways to catch multiple Exceptions using a single except clause. In this article …

Read More about Python catch multiple exceptions

Python: Manually throw/raise an Exception using the “raise” statement

In this article let us learn how to manually throw an exception in Python. How to throw/raise an Exception in Python An Exception can be manually thrown/raised using the raise statement in Python. Let us start with a simple example. Running that code will result in an output like below As you can see, we …

Read More about Python: Manually throw/raise an Exception using the “raise” statement

Exceptions in Python: Everything You Need To Know!

In this article let us learn about “Exceptions” in Python and the various ways of handling them. The craftsmanship of a programmer can be measured by the degree of robustness of the code they write. To be an excellent python craftsman, we need to learn everything we can about Exceptions. Let us start by understanding …

Read More about Exceptions in Python: Everything You Need To Know!