testraise.py
来自「Python Development Environment (Python I」· Python 代码 · 共 35 行
PY
35 行
class fooexception(Exception):
def __init__(self, msg):
Exception.__init__(self)
print msg
def __init__(self):
Exception.__init__(self)
print "i am a fooexception"
data = 2
raise "foo"
raise "foo", data
# before
raise fooexception # on-line
# after
# before
raise fooexception, "bla" # on-line
# after
raise fooexception, [1, 2, 3]
raise fooexception, range(3)
raise fooexception, (1, 2, 3)
raise fooexception, (1, 2, 3), 1
# after
raise fooexception, (1, 2, 3), "foo" # on-line
# after
raise fooexception, (1, 2, 3), (1, 2, 3)
raise fooexception, (1, 2, 3), [1, 2, 3]
# after
raise fooexception, (1, 2, 3), range(1) # on-line
# after
raise fooexception, (1, 2, 3), (1 + 1)
raise
raise fooexception, (1, 2, 3), 1 + 1
raise
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?