小编Ano*_*mus的帖子

python beautifulsoup:lxml html.parser

我必须使用beautifulsoup,但是我不知道我必须使用哪个解析器。我对lxml和html.parser犹豫不决,或者为什么不两者都选择。如何知道网页是否符合lxml?如何知道网页是否符合html解析器?非常感谢

python lxml beautifulsoup html-parser

1
推荐指数
1
解决办法
1054
查看次数

搜索元组列表

我提取一个数据集行:

(u"[('x-xss-protection', '1; mode=block'), ('x-powered-by', 'PHP/5.4.21 ZendServer/6.2.0'), ('transfer-encoding', 'chunked'), ('expires', '0'), ('vary', 'Accept-Encoding'), ('server', 'nginx'), ('last-modified', 'Thu, 03 Dec 2015 10:20:02 GMT'), ('connection', 'keep-alive'), ('pragma', 'no-cache'), ('cache-control', 'must-revalidate, post-check=0, pre-check=0, public'), ('date', 'Thu, 03 Dec 2015 10:20:02 GMT'), ('x-cached', 'EXPIRED'), ('content-type', 'text/html')]",)
Run Code Online (Sandbox Code Playgroud)

我想找到'内容类型'.我尝试过dict,list,enumerate,str,......但是没有任何作用:(

python

-2
推荐指数
1
解决办法
52
查看次数

标签 统计

python ×2

beautifulsoup ×1

html-parser ×1

lxml ×1