手机
当前位置:查字典教程网 >脚本专栏 >python >python使用htmllib分析网页内容的方法
python使用htmllib分析网页内容的方法
摘要:本文实例讲述了python使用htmllib分析网页内容的方法。分享给大家供大家参考。具体实现方法如下:importhtmllib,urll...

本文实例讲述了python使用htmllib分析网页内容的方法。分享给大家供大家参考。具体实现方法如下:

import htmllib, urllib, formatter, sys website = urllib.urlopen("http://yourweb.com") data = website.read() website.close() format = formatter.AbstractFormatter(formatter.DumbWriter(sys.stdout)) ptext = htmllib.HTMLParser(format) ptext.feed(data) ptext.close()

希望本文所述对大家的Python程序设计有所帮助。

【python使用htmllib分析网页内容的方法】相关文章:

Python strip lstrip rstrip使用方法

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

python 域名分析工具实现代码

python创建和使用字典实例详解

python操作日期和时间的方法

Python yield使用方法示例

python生成指定长度的随机数密码

python BeautifulSoup使用方法详解

python使用scrapy解析js示例

从零学python系列之浅谈pickle模块封装和拆封数据对象的方法

精品推荐
分类导航