网络编程
位置:首页>> 网络编程>> Python编程>> Python中获取网页状态码的两个方法

Python中获取网页状态码的两个方法

作者:小渣渣  发布时间:2023-08-27 22:47:21 

标签:Python,网页状态码

第一种是用urllib模块,下面是例示代码:

import urllib
status=urllib.urlopen("https://www.asxphome.com").code
print status

第二章是用requests模块,下面是例示代码:

import requests
code=requests.get("https://www.asxphome.com").status_code
print code
0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com