BeautifulSoup,但对于 CSS? [英] BeautifulSoup, but for CSS?

查看:20
本文介绍了BeautifulSoup,但对于 CSS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

BeautifulSoup 解析 HTML 并提供各种在 HTML 中操作和搜索的方法.CSS 有没有类似的东西?

BeautifulSoup parses HTML and offers various ways to manipulate and search within HTML. Is there something similar for CSS?

具体来说,我想知道给定的 HTML 文本是否呈现为粗体.它要么有一个祖先,即 标签(可以用 BeautifulSoup 完成),或者它有一个祖先(或它本身) 具有 font-weight: bold 的 CSS 属性.

Specifically, I'd like to know if a given HTML text is rendered as bold. Either it has an ancestor that is the <strong> or the <bold> tag (which can be done with BeautifulSoup), or it has an ancestor (or itself) that has CSS attributes with font-weight: bold.

这可能不会导致编写我自己的库吗?

Is this possible without resulting to writing my own library?

推荐答案

看看 CSSParsercssutils 包.

这篇关于BeautifulSoup,但对于 CSS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆