摘要:
1.prettify ():把要解析的字符串以标准的缩进格式化输出 <实例如下: html =""" <html> <head> <title>The Dormouse's story</title> </heads> <body> <p class="title" name="dromouse"> 阅读全文
posted @ 2026-11-09 20:32
abner_pan
阅读(8)
评论(0)
推荐(0)
摘要:
初始化方法 第一步:从bs4库导入BeautifulSoup模块 from bs4 import BeautifulSoup 第二步:实例化BeautifulSoup对象 soup = BeautifulSoup(html,'lxml') 第一个参数为要解析的文档字符串 第二个参数为解析器类型(这里 阅读全文
posted @ 2026-11-09 20:25
abner_pan
阅读(7)
评论(0)
推荐(0)
摘要:
1.需要安装两个库:Beautiful Soup和lxml 2.Beautiful库的安装方法:pip install beautifusoup4 3.lxml库的安装方法:pip install lxml (xpath也是用lxml库来跑通的) 阅读全文
posted @ 2026-11-09 19:54
abner_pan
阅读(7)
评论(0)
推荐(0)
摘要:
1.Beautiful Soup是Python的一个HTML解析库 2.Beautiful Soup是借助网页的结构和属性等特性来解析网页 3.Beautiful Soup自动将输入文档转换为Unicode编码,将输出文档转换为utf-8编码 4.Beautiful Soup在解析时是依赖解析器的, 阅读全文
posted @ 2026-11-09 19:51
abner_pan
阅读(8)
评论(0)
推荐(0)

浙公网安备 33010602011771号