Python中文
首页
教程
问答
标签
搜索
登录
注册
Python beauthulsoup解析特定tex
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>我正在解析一个html文件,我想找到文件中写着“小报告公司”的部分,旁边有一个“X”或复选框,或者没有。复选框通常是用Wingdings字体或ascii代码完成的。在下面的HTML中,您将看到它旁边的wingdings中有一个<code>&#254;</code>。在</p> <p>我可以显示正则表达式搜索文本的结果,但在下一步中查找复选框时遇到了问题。在</p> <p>我将使用它来解析许多不同的html文件,这些文件的格式不完全相同,但大多数文件都将使用类似于本例的表格和ascii文本。在</p> <p>以下是HTML代码:</p> <pre><code><HTML> <HEAD><TITLE></TITLE></HEAD> <BODY> <DIV align="left">Indicate by check mark whether the registrant is a large accelerated filer, an accelerated filer, a non-accelerated filer, or a smaller reporting company. See the definitions of &#147;large accelerated filer,&#148; &#147;accelerated filer&#148; and &#147;smaller reporting company&#148;. (Check one): </DIV> <DIV align="center"> <TABLE style="font-size: 10pt" cellspacing="0" border="0" cellpadding="0" width="100%"> <!-- Begin Table Head --> <TR valign="bottom"> <TD width="22%">&nbsp;</TD> <TD width="3%">&nbsp;</TD> <TD width="22%">&nbsp;</TD> <TD width="3%">&nbsp;</TD> <TD width="22%">&nbsp;</TD> <TD width="3%">&nbsp;</TD> <TD width="22%">&nbsp;</TD> </TR> <TR></TR> <!-- End Table Head --> <!-- Begin Table Body --> <TR valign="bottom"> <TD align="center" valign="top"><FONT style="white-space: nowrap"> Large accelerated filer <FONT style="font-family: Wingdings">&#111;</FONT></FONT> </TD> <TD>&nbsp;</TD> <TD align="center" valign="top"><FONT style="white-space: nowrap">Accelerated filer <FONT style="font-family: Wingdings">&#111;</FONT></FONT> </TD> <TD>&nbsp;</TD> <TD align="center" valign="top"><FONT style="white-space: nowrap"> Non-accelerated filer <FONT style="font-family: Wingdings">&#111;</FONT> </FONT> <FONT style="white-space: nowrap">(Do not check if a smaller reporting company)</FONT> </TD> <TD>&nbsp;</TD> <TD align="center" valign="top"><FONT style="white-space: nowrap"> Smaller reporting company <FONT style="font-family: Wingdings">&#254;</FONT></FONT></TD> </TR> <!-- End Table Body --> </TABLE> </DIV></BODY></HTML> </code></pre> <p>下面是我的Python代码:</p> ^{pr2}$ <p>问题: 我如何设置此项以进行依赖于第一次搜索的第二次搜索?所以当我找到“小报告公司”时,我可以搜索接下来的几行,看看是否有ascii码?我一直在看汤医生。我试着做find and findNext,但没能让它发挥作用。在</p>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>您可以尝试遍历结构并检查内部标记内的值或检查外部标记中的值。我已经记不清该怎么做了,最后我使用了lxml来实现这一点,但我认为bsoup可以做到这一点。在</p> <p>如果你不能让bsoup来做,那就看看lxml。它可能更快取决于你在做什么。它还有一些钩子,可以在lxml中使用bsoup。在</p>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
如何在乒乓球比赛中预测球的轨迹,对于AI球拍预测?
4 回答
如何在乒乓球游戏中阻止球
2 回答
如何在乘法和模中不乘空间?
1 回答
如何在乘法和除以2个不同的数字之间进行交换?
4 回答
如何在也是数据一部分的单个字符上拆分大字符串
5 回答
如何在乾草堆中找到針,有更好的解決方案嗎?
3 回答
如何在事件wxWidgets中传递自定义数据
8 回答
如何在事件中使用lambda i=i?
8 回答
如何在事件中心只接收最近的数据
5 回答
如何在事件发生之前保持云函数运行?
8 回答
如何在事件发生后使页面重定向到同一页面
4 回答
如何在事件回调之间保持python生成器的状态
5 回答
如何在事件处理程序(pythonsocket、sphinx)中保留docstring
8 回答
如何在事件处理程序中更改wxRichTextCtrl的光标位置?
3 回答
如何在事件处理程序中访问外部对象?
10 回答
如何在事件循环中将协程打包为正常函数?
6 回答
如何在事件循环之外运行协同程序?
2 回答
如何在事件循环结束时为并发未来的所有线程调用类方法?
4 回答
如何在事件文件中只保留一份摘要?
6 回答
如何在事件模板中添加事件
8 回答