手机
当前位置:查字典教程网 >脚本专栏 >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在linux中输出带颜色的文字的方法

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

python client使用http post 到server端的代码

Python yield使用方法示例

python多线程抓取天涯帖子内容示例

python调用shell的方法

python操作日期和时间的方法

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

Python中使用动态变量名的方法

Python中使用urllib2防止302跳转的代码例子

精品推荐
分类导航