Working with the Exception Information : Error Exception « Statement « Python Tutorial

Python Tutorial
1. Introduction
2. Data Type
3. Statement
4. Operator
5. String
6. Tuple
7. List
8. Dictionary
9. Collections
10. Function
11. Class
12. File
13. Buildin Function
14. Buildin Module
15. Database
16. Regular Expressions
17. Thread
18. Tkinker
19. wxPython
20. XML
21. Network
22. CGI Web
23. Windows
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorial
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Python Tutorial » Statement » Error Exception 
3. 9. 16. Working with the Exception Information
import sys

try :
        raise ValueError, "Got an error"
except :
        if sys.exc_type == ValueError :
               print "Value Error"
        else :
               print "Something else"
3. 9. Error Exception
3. 9. 1. Catching Exceptions with try..except
3. 9. 2. ZeroDivisionError: division by any numeric zero
3. 9. 3. IndexError: request for an out-of-range index for sequence
3. 9. 4. KeyError: request for a non-existent dictionary key
3. 9. 5. AssertionError
3. 9. 6. IOError: input/output error
3. 9. 7. AttributeError: attempt to access an unknown object attribute
3. 9. 8. try-except Statement
3. 9. 9. try Statement with Multiple excepts
3. 9. 10. except Statement with Multiple Exceptions
3. 9. 11. replace our single error string with the string representation of the exception argument.
3. 9. 12. Demonstrating a programmer-defined exception class.
3. 9. 13. Exceptions Can Be Classes
3. 9. 14. Exception Classes
3. 9. 15. String-Based Exceptions
3. 9. 16. Working with the Exception Information
www.java2java.com | Contact Us
Copyright 2010 - 2030 Java Source and Support. All rights reserved.
All other trademarks are property of their respective owners.