搜索结果
查询Tags标签: BeautifulSoup,共有 83条记录-
[Python] BeautifulSoup模块用法演示
from bs4 import BeautifulSoup, element# 演示用html文本 html = """ <html><head><title>The Dormouses story</title></head><body><p class="title" name="dromouse"><b>The Dor…
2021/11/29 9:06:55 人评论 次浏览 -
[Python] BeautifulSoup模块用法演示
from bs4 import BeautifulSoup, element# 演示用html文本 html = """ <html><head><title>The Dormouses story</title></head><body><p class="title" name="dromouse"><b>The Dor…
2021/11/29 9:06:55 人评论 次浏览 -
#python学习笔记(十六)#解析HTML,BeautifulSoup
目录 1 应用正则表达式解析HTML 2 应用 BeautifulSoup解析HTMLWeb scraping is when we write a program that pretends to be a web browser and retrieves pages, then examines the data in those pages looking for patterns. Web抓取是指我们编写一个程序,假装是一个…
2021/11/5 22:39:30 人评论 次浏览 -
#python学习笔记(十六)#解析HTML,BeautifulSoup
目录 1 应用正则表达式解析HTML 2 应用 BeautifulSoup解析HTMLWeb scraping is when we write a program that pretends to be a web browser and retrieves pages, then examines the data in those pages looking for patterns. Web抓取是指我们编写一个程序,假装是一个…
2021/11/5 22:39:30 人评论 次浏览 -
python获取script里的内容
import requests from bs4 import BeautifulSoupurl1 = "https://www.zzlian.com/33.html" html = requests.get(url1).content html=html.decode(utf-8) # python3 soup = BeautifulSoup(html, "html.parser") a = soup.select(script[type="ap…
2021/10/25 9:10:16 人评论 次浏览 -
python获取script里的内容
import requests from bs4 import BeautifulSoupurl1 = "https://www.zzlian.com/33.html" html = requests.get(url1).content html=html.decode(utf-8) # python3 soup = BeautifulSoup(html, "html.parser") a = soup.select(script[type="ap…
2021/10/25 9:10:16 人评论 次浏览 -
Python爬虫之利用requests,BeautifulSoup爬取小说标题、章节
爬取雪鹰领主标题和章节内容为列:查看网页的源代码,如下图所示: 获取html内容部分 import requests headers = {User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko} response = requests.get(https://quanxiaoshuo.com/177913/, he…
2021/10/21 20:09:46 人评论 次浏览 -
Python爬虫之利用requests,BeautifulSoup爬取小说标题、章节
爬取雪鹰领主标题和章节内容为列:查看网页的源代码,如下图所示: 获取html内容部分 import requests headers = {User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko} response = requests.get(https://quanxiaoshuo.com/177913/, he…
2021/10/21 20:09:46 人评论 次浏览 -
网络爬虫第二章
BeautifulSoup 介绍 Beautiful Soup 是一个可以从HTML或XML文件中提取数据的python库 安装 安装Beautiful Soup 4 pip install bs4 安装lxml pip install lxml //解析器 BeautifulSoup对象 代表要解析整个文档树 它支持遍历文档树和搜索文档树中描述的大部分的方法 …
2021/9/2 23:09:30 人评论 次浏览 -
网络爬虫第二章
BeautifulSoup 介绍 Beautiful Soup 是一个可以从HTML或XML文件中提取数据的python库 安装 安装Beautiful Soup 4 pip install bs4 安装lxml pip install lxml //解析器 BeautifulSoup对象 代表要解析整个文档树 它支持遍历文档树和搜索文档树中描述的大部分的方法 …
2021/9/2 23:09:30 人评论 次浏览 -
python使用beautifulsoup报错You're probably treating a list of items like a single item. Did you cal
在写beautifulsoup模块,学到用find_all()方法来通过属性筛选标签,但是调取返回值的时候报错 翻译过来就是: ResultSet对象没有属性‘%s‘。您可能将list作为单个项来处理。当您要调用find()时,是否调用了find_all()?对象没有属性‘find_all’。你可能会把list当成ii…
2021/8/22 11:06:05 人评论 次浏览 -
python使用beautifulsoup报错You're probably treating a list of items like a single item. Did you cal
在写beautifulsoup模块,学到用find_all()方法来通过属性筛选标签,但是调取返回值的时候报错 翻译过来就是: ResultSet对象没有属性‘%s‘。您可能将list作为单个项来处理。当您要调用find()时,是否调用了find_all()?对象没有属性‘find_all’。你可能会把list当成ii…
2021/8/22 11:06:05 人评论 次浏览 -
beautifulsoup4库安装、使用
(venv) D:\pytest>pip install beautifulsoup Collecting beautifulsoupUsing cached https://files.pythonhosted.org/packages/1e/ee/295988deca1a5a7accd783d0dfe14524867e31abb05b6c0eeceee49c759d/BeautifulSoup-3.2.1.tar.gzComplete output from command python…
2021/8/8 6:08:42 人评论 次浏览 -
beautifulsoup4库安装、使用
(venv) D:\pytest>pip install beautifulsoup Collecting beautifulsoupUsing cached https://files.pythonhosted.org/packages/1e/ee/295988deca1a5a7accd783d0dfe14524867e31abb05b6c0eeceee49c759d/BeautifulSoup-3.2.1.tar.gzComplete output from command python…
2021/8/8 6:08:42 人评论 次浏览 -
bs4解析
数据解析的原理: 标签定位提取标签、标签属性中存储的数据值 bs4数据解析的原理: 实例化一个BeautifulSoup对象,并且将页面源码数据加载到该对象中通过调用BeautifulSoup对象中相关的属性或者方法进行标签定位和数据提取 如何实例化BeautifulSoup对象: from bs4 import…
2021/8/2 23:07:33 人评论 次浏览