擅长:python、mysql、java
<p>使用lxml进行解析:</p>
<pre><code>from lxml import html
doc = html.fromstring(raw_html)
doc.xpath('//span[contains(@class,"offer-price")]')[0].text
</code></pre>
<p>返回:'$13.00'</p>
<p>xpath部分只需查找所有的span:<code>//span</code>,并为特定的类标记<code>[contains(@class,"offer-price")]</code>过滤这些跨度</p>