1
laiwei 2012 年 3 月 1 日 via Android
|
3
lcxz 2012 年 3 月 1 日
用 正规则表达式 将div内的标签去掉就剩下你想要的内容了
|
5
phus 2012 年 3 月 1 日
HTML = u'''\
<div class="c"> <span class="cmt"><a href="...">游完1200才閃</a> 对 我 说:</span> 你好,转发的赠书大概什么时候送到,上海的,谢谢 <span class="ct">2011-09-16 21:17:35</span> <a href="....." class="cc">回复他 </a> <a href="......." class="cc">共3条对话</a> </div> ''' def main(): tree = lxml.etree.fromstring(HTML, lxml.etree.HTMLParser()) print ''.join(x.strip() for x in tree.xpath('//div[@class="c"]/text()')) |
6
linlinqi 2012 年 3 月 1 日
php的话,看看phpQuery. http://code.google.com/p/phpquery/
|
7
orzzzzz 2012 年 3 月 1 日
simpledom里find(".cmt")后,取innerText?
|