python3简单爬虫实现代码
2014-05-30 16:41
866 查看
分享一个python实现的网络爬虫代码。转自:http://www.cnblogs.com/yes123/p/3761388.html
写了个python3的。代码非常简单就不解释了,直接贴代码。
关于cookie、异常等处理看了下,没有花时间去处理,毕竟只是想通过写爬虫来学习python。
python网络爬虫采集联想词实例
python博客文章爬虫实现代码
Python web爬虫的小例子
python 网络爬虫(经典实用型)
Python 网易新闻小爬虫的实现代码
python网络爬虫的代码
python 实现从百度开始不断搜索的爬虫
python编写分布式爬虫的思路
Python实现天气预报采集器(网页爬虫)的教程
写了个python3的。代码非常简单就不解释了,直接贴代码。
#test rdp import urllib.request import re #登录用的帐户信息 data={} data['fromUrl']='' data['fromUrlTemp']='' data['loginId']='12345' data['password']='12345' user_agent='Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)' #登录地址 #url='http://192.168.1.111:8080/loginCheck' postdata = urllib.parse.urlencode(data) postdata = postdata.encode('utf-8') headers = { 'User-Agent' : user_agent } #登录 res = urllib.request.urlopen(url,postdata) #取得页面html strResult=(res.read().decode('utf-8')) #用正则表达式取出所有A标签 p = re.compile(r'<a href="(.*?)".*?>(.*?)') for m in p.finditer(strResult): print (m.group(1))#group(1)是href里面的内容,group(2)是a标签里的文字
关于cookie、异常等处理看了下,没有花时间去处理,毕竟只是想通过写爬虫来学习python。
您可能感兴趣的文章:
python 网络爬虫实例代码python网络爬虫采集联想词实例
python博客文章爬虫实现代码
Python web爬虫的小例子
python 网络爬虫(经典实用型)
Python 网易新闻小爬虫的实现代码
python网络爬虫的代码
python 实现从百度开始不断搜索的爬虫
python编写分布式爬虫的思路
Python实现天气预报采集器(网页爬虫)的教程
相关文章推荐
- 5行python代码实现简单的网络爬虫
- Python实现爬取知乎神回复简单爬虫代码分享
- python实现简单爬虫功能代码
- Python实现爬取知乎神回复简单爬虫代码分享
- Python实现爬取知乎神回复简单爬虫代码分享
- Python采集案例:Python实现爬取知乎神回复简单爬虫代码
- 1. python实现简单爬虫功能
- 借助apktool.jar工具,使用python代码简化批量反编译apk安装包的简单实现
- 研磨设计模式解析及python代码实现——(一)简单工厂模式
- Python实现抓取页面上链接的简单爬虫分享
- Python实现3行代码解简单的一元一次方程
- 实现一个简单的邮箱地址爬虫(python)
- 网络爬虫(五)------------简单网络爬虫实现代码,记得要添加htmlpaser和htmlclient两个包
- python打造百行代码实现简单的下载器
- python实现简单爬虫功能
- python实现简单爬虫模拟登录淘宝(cookie简介)
- 简单爬虫python实现02——BeautifulSoup的使用
- Python天气预报采集器实现代码(网页爬虫)
- python实现简单爬虫功能
- python设置检查点简单实现代码