BeautifulSoup:按样式查找表 [英] BeautifulSoup: Find table by style

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

问题描述

是否可以找到具有独特风格的特定桌子?

Is it possible to find a specific table with unique style?

说,给出以下html:

Say, given the following html:

<table border="1" style="background-color:White;font-size:10pt;border-collapse:collapse;">

如何使用BS查找该表?

How can I use BS to find that table?

谢谢

推荐答案

尝试一下:

from bs4 import BeautifulSoup
bs = BeautifulSoup(htmlcontent)
bs.find_all('table', attrs={'border': '1' ,'style':'background-color:White;font-size:10pt;border-collapse:collapse;'})

查看此链接以了解更多详细信息.

Check this link for more details.

这篇关于BeautifulSoup:按样式查找表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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