- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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.
Advertisements