close

 

The raise statement allows the programmer to force a specified exception to occur. For example:

>>> raise NameError('HiThere')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
NameError: HiThere

 

The sole argument to raise indicates the exception to be raised. This must be either an exception instance or an exception class (a class that derives from Exception).

8. Errors and Exceptions — Python v2.7.1 documentation
http://docs.python.org/tutorial/errors.html#raising-exceptions

arrow
arrow
    全站熱搜

    peicheng 發表在 痞客邦 留言(0) 人氣()