备案域名网 发表于 2018-5-6 20:38:36

Python异常处理代码

import urllib.error
    try:
    except urllib.error.URLError as e:
      if hasattr(e,"code"):
            print(e.code)
      if hasattr(e,"reason")
            print(e,"reason")
    except Exception as e:
页: [1]
查看完整版本: Python异常处理代码