Discuss / Python / 最后的抛出错误好像写反了

最后的抛出错误好像写反了

Topic source

##原文:

try:
        product()
        print('测试失败!')
    except TypeError:
        print('测试成功!')

##我测试的结果都是对的,但打印是“测试失败” 试了一下,好像是这样:

try:
        product()
         print('测试成功!')
    except TypeError:
          print('测试失败!')

  • 1

Reply