1. python3 异常不再接收逗号(,)作为参数:

## python3 中这样可以正常运行
try:
    print("在这里执行的代码,有异常进入except")
except Exception as e:
    ## print(str(sys.exc_info()))  ## sys.exc_info() 完整的异常信息栈
    print(str(e))


## python2 中这样可以正常运行,但是python3中会报错
try:
    print("在这里执行的代码,有异常进入except")
except Exception, e:
    ## print(str(sys.exc_info()))  ## sys.exc_info() 完整的异常信息栈
    print(str(e))

 

相关文章:

  • 2021-12-05
  • 2021-11-05
  • 2022-12-23
  • 2021-06-09
  • 2022-12-23
  • 2021-11-29
  • 2021-12-23
  • 2021-09-03
猜你喜欢
  • 2022-12-23
  • 2022-02-23
  • 2022-01-28
  • 2022-12-23
  • 2021-09-25
相关资源
相似解决方案