Python中获取网页状态码的两个方法
作者:小渣渣 时间:2023-08-27 22:47:21
第一种是用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
标签:Python,网页状态码
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
python能做哪些生活有趣的事情
2023-05-07 01:50:43
![](https://img.aspxhome.com/file/2023/2/131452_0s.png)
使用python实现简单五子棋游戏
2022-09-22 04:16:35
![](https://img.aspxhome.com/file/2023/4/133844_0s.png)
Mysql数据库常用命令
2009-03-06 14:29:00
MAC版修改MySQL初始密码的方法
2024-01-19 03:19:56
Javascript命名禁区[110407.updated]
2011-04-28 09:48:00
SqlServer创建自动收缩事务日志任务的图文教程
2024-01-23 23:44:40
![](https://img.aspxhome.com/file/2023/9/119249_0s.png)
oracle中rownum和row_number()
2024-01-12 19:21:37
IE8 的 noscript 标签 Bug
2009-08-18 12:37:00
![](https://img.aspxhome.com/file/UploadPic/20098/18/medium-28s.jpg)
Python的加密模块md5、sha、crypt使用实例
2022-02-17 14:44:44
详解SQL Server数据库状态和文件状态
2024-01-26 14:09:28
PDO::errorInfo讲解
2023-06-06 01:51:53
详解Mysql自动备份与恢复的几种方法(图文教程)
2024-01-20 20:05:06
![](https://img.aspxhome.com/file/2023/7/112887_0s.jpg)
利用python实现PSO算法优化二元函数
2022-06-17 20:53:04
![](https://img.aspxhome.com/file/2023/5/70225_0s.jpg)
Python实现控制手机电脑拍照并自动发送邮箱
2022-10-08 01:52:33
![](https://img.aspxhome.com/file/2023/3/72133_0s.png)
node.js+express+mySQL+ejs+bootstrop实现网站登录注册功能
2023-07-15 17:55:01
![](https://img.aspxhome.com/file/2023/9/55989_0s.gif)
JavaScript命令模式原理与用法实例详解
2024-04-23 09:32:04
![](https://img.aspxhome.com/file/2023/2/135482_0s.png)
详解Python手写数字识别模型的构建与使用
2023-10-21 18:34:12
![](https://img.aspxhome.com/file/2023/2/100292_0s.png)
asp如何做一个只能从本站点才能访问的页面?
2010-07-12 19:00:00
详解Python之unittest单元测试代码
2022-04-15 02:28:12
![](https://img.aspxhome.com/file/2023/0/130560_0s.png)
分享PHP header函数使用教程
2023-09-04 12:07:14