码迷,mamicode.com
首页 >  
搜索关键字:beautifulsoup    ( 1186个结果
beautifulsoup测试
import re from bs4 import BeautifulSoup html_doc = """ <html><head><title>The Dormouse's story</title></head> <body> <p class="title"><b>The Dormouse' ...
分类:其他好文   时间:2016-11-30 02:50:15    阅读次数:250
抓取新浪新闻的内容以及链接
import requestsfrom bs4 import BeautifulSoupres = requests.get('http://news.sina.com.cn/china/')res.encoding='utf-8'soup = BeautifulSoup(res.text,'htm ...
分类:其他好文   时间:2016-11-27 19:23:08    阅读次数:206
BeautifulSoup使用
request能取到网页上面的数据,但是这些是属于结构化的数据,我们不能直接使用,需要将这些数据进行转化,从而方便使用 BeautifulSoup能将标签移除掉,从而获得网页上的数据以及内容 1、将特定标签的内容取出来 单个标签 ...
分类:其他好文   时间:2016-11-27 19:01:50    阅读次数:142
Python爬虫抓取 python tutorial中文版,保存为word
看到了中文版的python tutorial,发现是网页版的,刚好最近在学习爬虫,想着不如抓取到本地 首先是网页的内容 查看网页源码后发现可以使用BeautifulSoup来获取文档的标题和内容,并保存为doc文件。 这里需要使用from bs4 import BeautifulSoup 来导入该模 ...
分类:编程语言   时间:2016-11-27 07:26:36    阅读次数:167
python爬取手机归属地
用python+bs4爬取了手机归属地数据: import urllib.request from bs4 import BeautifulSoup def spider1(url): headers = {'User-Agent':'Mozilla/5.0 (Windows NT 6.1) App ...
分类:移动开发   时间:2016-11-25 17:28:06    阅读次数:256
BeautifulSoup Some characters could not be decoded, and were replaced with REPLACEMENT CHARACTER.
BeautifulSoup很赞的东西 最近出现一个问题:Python 3.3 soup=BeautifulSoup(urllib.request.urlopen(url_path),"html.parser") soup.findAll("a",{"href":re.compile('^http|^ ...
分类:其他好文   时间:2016-11-19 13:04:14    阅读次数:419
Python简单爬虫入门二
接着上一次爬虫我们继续研究BeautifulSoup Python简单爬虫入门一 上一次我们爬虫我们已经成功的爬下了网页的源代码,那么这一次我们将继续来写怎么抓去具体想要的元素 首先回顾以下我们BeautifulSoup的基本结构如下 重要事情再次强调这是我们开始爬取网页的一个基本结构,如同建楼的一 ...
分类:编程语言   时间:2016-11-17 12:42:01    阅读次数:200
Python3操作Excel
本文利用Python3爬虫抓取豆瓣图书Top250,并利用xlwt模块将其存储至excel文件,图片下载到相应目录。旨在进行更多的爬虫实践练习以及模块学习。 工具 1.Python 3.5 2.BeautifulSoup、xlwt模块 开始动手 首先查看目标网页的url: https://book. ...
分类:编程语言   时间:2016-11-15 08:19:12    阅读次数:268
python3用BeautifulSoup用re.compile来匹配需要抓取的href地址
...
分类:编程语言   时间:2016-11-14 01:56:58    阅读次数:355
python3用BeautifulSoup用limit来获取指定数量的a标签
result: .<a class="sister" href="http://example.com/elsie" id="xiaodeng"><!-- Elsie --></a><a class="sister" href="http://example.com/lacie" id="link2 ...
分类:编程语言   时间:2016-11-14 01:29:34    阅读次数:189
1186条   上一页 1 ... 95 96 97 98 99 ... 119 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!