以前的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
否则会报错的
python3.x的异常处理,布布扣,bubuko.com
python3.x的异常处理
原文:http://blog.csdn.net/awj3584/article/details/38233293