1. 程式人生 > >urllib.error

urllib.error

import urllib.request
import urllib.error

# url = 'http://www.maodan.com/'


url = 'https://www.cnblogs.com/zhuyue1/p/6408811.html'

try:
	response = urllib.request.urlopen(url)
# Exception 異常基類,所有異常類的直接或者間接的父類
except urllib.error.HTTPError as e:
	print(e)

print('不影響程式碼接著執行')