python分析网页上所有超链接的方法
作者:work24 时间:2021-03-15 05:28:08
本文实例讲述了python分析网页上所有超链接的方法。分享给大家供大家参考。具体实现方法如下:
import urllib, htmllib, formatter
website = urllib.urlopen("http://yourweb.com")
data = website.read()
website.close()
format = formatter.AbstractFormatter(formatter.NullWriter())
ptext = htmllib.HTMLParser(format)
ptext.feed(data)
for link in ptext.anchorlist:
print(link)
希望本文所述对大家的Python程序设计有所帮助。
标签:python,网页,超链接
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
优化 SQL Server 索引的小技巧
2012-10-07 11:00:07
python pandas时序处理相关功能详解
2023-07-25 12:03:18
使用python搭建Django应用程序步骤及版本冲突问题解决
2023-01-29 07:36:34
![](https://img.aspxhome.com/file/2023/1/63891_0s.jpg)
IE中不可遍历的属性
2010-01-19 13:47:00
Python sklearn预测评估指标混淆矩阵计算示例详解
2023-12-19 23:39:21
![](https://img.aspxhome.com/file/2023/7/71437_0s.jpg)
关于Python 中的时间处理包datetime和arrow的方法详解
2023-11-16 12:18:48
基于tkinter中ttk控件的width-height设置方式
2023-07-04 21:32:20
![](https://img.aspxhome.com/file/2023/3/62563_0s.png)
解析ASP的Application和Session对象
2007-09-14 10:13:00
python实现斐波那契递归函数的方法
2022-03-22 19:54:49
IE8新特性及IE8安装使用 目录
2008-04-01 09:50:00
陌生网页交互行为分析(1)——奇怪的关闭按钮
2009-01-08 12:22:00
![](https://img.aspxhome.com/file/UploadPic/20091/8/2008-12-30_155447-20s.png)
asp无限级分类
2007-09-16 18:06:00
ORACLE常见错误代码的分析与解决三
2010-07-26 13:28:00
MySQL两种识别是否有中文字符的方法
2011-01-04 20:11:00
解决python Jupyter不能导入外部包问题
2021-02-02 06:19:03
![](https://img.aspxhome.com/file/2023/0/72790_0s.jpg)
不用为美化select烦恼模仿combox(select)控件
2007-08-04 21:08:00
![](https://img.aspxhome.com/file/UploadPic/20078/4/20078421213719.gif)
asp 实现当有新信息时播放语音提示的效果
2011-03-31 11:00:00
如何处理好网页色彩搭配
2007-08-10 13:22:00
[翻译]标记语言和样式手册 Chapter 2 标题
2008-01-16 11:56:00
![](https://img.aspxhome.com/file/UploadPic/20081/16/2008116121440368s.jpg)
Python 私有化操作实例分析
2022-11-06 05:44:42
![](https://img.aspxhome.com/file/2023/9/69049_0s.png)