
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
How to use the ‘except clause’ with No Exceptions in Python?
If we define except clause with no exceptions, it can handle all types of exceptions. However, neither it’s a good coding practice nor it is recommended.
Example
try: print 'foo'+'qux'+ 7 except: print' There is error'
Output
You get the output
There is error
This type of Python try-except block can handle all types of exceptions, but it’ll not be helpful to the programmer to find which type of exception occurred.
- Related Articles
- How to use the ‘except’ clause with multiple exceptions in Python?
- How to catch multiple exceptions in one line (except block) in Python?
- How do you handle an exception thrown by an except clause in Python?
- How to use the try-finally clause to handle exception in Python?
- How can I write a try/except block that catches all Python exceptions?
- How to use MySQL VIEW with WHERE clause?
- How to use Custom Exceptions in JavaScript?
- How to use MySQL Date functions with WHERE clause?
- How Can we use MySQL DISTINCT clause with WHERE and LIMIT clause?
- How to use jQuery.slice() method with no arguments?
- User-defined Exceptions in Python with Examples
- How to declare custom exceptions in modern Python?
- How to use user variables in MySQL LIKE clause?
- How to use MySQL LIKE clause to fetch multiple values beginning with “Johâ€
- How can we use MySQL SUM() function with HAVING clause?

Advertisements