Web Design San Jose California
ErrorPro   ErrorPro Mobile Site   MS WINDOWS  | UNIX /LINUX   | ORACLE  |  PERL  |  PYTHON  |  MAC OS |  MySQL »

 

Python Exception Handling

The try statement- try and except keywords

Program below asks the user for input until a valid integer and handle ValueError exceptions.

>>> while True:
... try:
... x = int(raw_input("Please enter a Integer: "))
... break
... except ValueError:
... print "Exception! That was no valid Integer."
...

A try statement may have more than one except clause.

An except clause may include many exceptions.

Example:

... except (NameError, KeyError, ZeroDivisionError):
... pass




SOURCE: Python Documentation
ONLINE RESOURCES:
Python Programming Language Official Website
Python Downloads
Python Mailing Lists, Newsgroups, and Web Forums

   


Web Hosting  Promotion

Copyright 2008-2009 © ErrorPRO - Free Web Directory - Software Error Codes, Messages, Descriptions, Causes and Recommended Actions.

Get domain of your choice NOW