【发布时间】:2016-02-18 21:54:17
【问题描述】:
我必须在 python 中使用 xpath 分析以下 html-content。我必须得到的内容是style-tag的内容。
<div class="chartBody">
<div class="chartRow">
<div class="chartLabel">Certificate</div>
<div class="chartBar_g" style="width:300px"> </div>
</div>
<div class="chartRow">
<div class="chartLabel">Protocol Support</div>
<div class="chartBar_a" style="width:210px"> </div>
</div>
</div>
包含样式标签的类不同。 每个人都可以告诉我 xpath 字符串,以获取列表中的所有样式内容吗?
【问题讨论】:
-
您真的只限于使用 xpath,您受限于哪些工具?使用 Beautiful Soup 或 Selenium 的任务相对简单,但同样我们需要了解更多信息才能选择正确的工具