随笔分类 -  爬虫

摘要:看排版更好的原文地址 BeautifulSoup库是解析、遍历、维护“标签树”的功能库 安装 sudo pip install beautifulsoup4 使用 # coding: UTF-8 import requests url="http://www.baidu.com" r=request 阅读全文
posted @ 2018-01-13 00:51 philhuan 阅读(12911) 评论(0) 推荐(0)
摘要:python爬虫下载文件 下载东西和访问网页差不多,这里以下载我以前做的一个安卓小游戏为例 地址为:http://hjwachhy.site/game/only_v1.1.1.apk 首先下载到内存 # coding: UTF-8 import requests url="http://hjwach 阅读全文
posted @ 2018-01-12 22:30 philhuan 阅读(29173) 评论(3) 推荐(0)
摘要:python爬虫小例子 python爬虫小实例 一个带异常处理的小例子 代码如下: import requests url="http://www.cnblogs.com/hjw1" try: r=requests.get(url) r.raise_for_status() print r.enco 阅读全文
posted @ 2018-01-12 21:45 philhuan 阅读(32976) 评论(1) 推荐(0)
摘要:python爬虫-Response对象 r=requests.get("http://www.baidu.com/") 属性 r.status_code http请求的返回状态,200表示连接成功,404表示连接失败 r.text http响应内容的字符串形式,url对应的页面内容 r.encodi 阅读全文
posted @ 2018-01-12 00:40 philhuan 阅读(22032) 评论(0) 推荐(0)
摘要:python爬虫入门 开发环境 ubuntu 16.04 sublime pycharm requests库 requests库安装: sudo pip install requests 第一个例子 import requests r=requests.get("http://www.baidu.c 阅读全文
posted @ 2018-01-11 23:47 philhuan 阅读(749) 评论(0) 推荐(1)