Home arrow Python arrow Page 8 - Python 101 (part 8): An Exceptionally Clever Snake

Strong Pythons (And The Exceptions That Love Them) - Python

In this concluding article of the Python 101 series, find out howto use Python's exception-handling routines to trap and resolve programerrors, learn to generate and use custom error messages, and get acquainteda bunch of useful (and free!) Python resources online.

TABLE OF CONTENTS:
  1. Python 101 (part 8): An Exceptionally Clever Snake
  2. Anatomy Of An Exception
  3. Trying Harder
  4. Different Strokes
  5. Passing The Buck
  6. Bad Boys
  7. Raising The Bar
  8. Strong Pythons (And The Exceptions That Love Them)
  9. The End Of The Affair
By: Vikram Vaswani, (c) Melonfire
Rating: starstarstarstarstar / 8
August 23, 2001

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement
A number of standard exceptions are built into Python - here's a list ofthe most common ones.

IOError - generated when an I/O operation fails;

ImportError - generated when a module import fails

IndexError - generated when an attempt is made to access a non-existentelement index;

KeyError - generated when an attempt is made to access a non-existentdictionary key;

MemoryError - generated when an out-of-memory error occurs;

NameError - generated when an attempt is made to access a non-existentvariable;

SyntaxError - generated when the interpreter finds a syntax error;

TypeError - generated when an attempt is made to run an operation on anincompatible object type;

ZeroDivisionError - generated when an attempt is made to divide by zero.

For a complete list, take a look athttp://www.python.org/doc/current/lib/module-exceptions.html

 
 
>>> More Python Articles          >>> More By Vikram Vaswani, (c) Melonfire
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PYTHON ARTICLES

- Python Big Data Company Gets DARPA Funding
- Python 32 Now Available
- Final Alpha for Python 3.2 is Released
- Python 3.1: String Formatting
- Python 3.1: Strings and Quotes
- Python 3.1: Programming Basics and Strings
- Tuples and Other Python Object Types
- The Dictionary Python Object Type
- String and List Python Object Types
- Introducing Python Object Types
- Mobile Programming using PyS60: Advanced UI ...
- Nested Functions in Python
- Python Parameters, Functions and Arguments
- Python Statements and Functions
- Statements and Iterators in Python

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: