import urllib.request
import urllib.error
url = "https://movie.douban.com/"
try:
resp = urllib.request.urlopen(url)
except urllib.error.HTTPError as e:
print("状态码", e.code)
print("原因", e.reason)
print("请求头", e.headers)
urllib.error.HTTPError异常处理
猜你喜欢
转载自blog.csdn.net/qq_46620129/article/details/114329833
今日推荐
周排行