python3.x的异常处理

来源:互联网 发布:批量拿webshell工具 编辑:程序博客网 时间:2024/06/04 08:45
以前的python2.x的时候:
try:
        fp=urllib.request.urlopen(blogurl)
    except Exception, e:
        print (e)
        print('download exception %s' % blogurl)
        return 0
 
现在python3.x的时候:
try:
        fp=urllib.request.urlopen(blogurl)
    except Exception as e:
        print (e)
        print('download exception %s' % blogurl)
        return 0
否则会报错的

0 0
原创粉丝点击