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
blog comments powered by Disqus |