python exception

来源:互联网 发布:手机壁纸主题软件 编辑:程序博客网 时间:2024/05/16 16:19

捕获 python 异常

import systry:    x = input('input the first number:')    y = input('input the second number:')    print('x/y = ', x/y)exception (ZeroDivisionError, TypeError, Number) as e:#exception (ZeroDivisionError, TypeError, Number), e python2.x    print('your number is bogus')    print e
  • 打印输出异常,便于排查问题
0 0