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

查看:133
本文介绍了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),或者它有一个祖先(或自己)有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?

推荐答案

看一看到 CSSParser cssutils 包。

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

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