手机
当前位置:查字典教程网 >脚本专栏 >python >python分析网页上所有超链接的方法
python分析网页上所有超链接的方法
摘要:本文实例讲述了python分析网页上所有超链接的方法。分享给大家供大家参考。具体实现方法如下:importurllib,htmllib,fo...

本文实例讲述了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分析网页上所有超链接的方法】相关文章:

Python获取脚本所在目录的正确方法

python实现监控linux性能及进程消耗性能的方法

python基础教程之类class定义使用方法

浅析python 内置字符串处理函数的使用方法

python每次处理固定个数的字符的方法总结

vc6编写python扩展的方法分享

下载给定网页上图片的方法

wxpython 最小化到托盘与欢迎图片的实现方法

python实现网页链接提取的方法分享

python字典多条件排序方法实例

精品推荐
分类导航