This topic created in 4186 days ago, the information mentioned may be changed or developed.
请问如何使用xpath语法实现只提取p标签中的内容,而不要em标签的内容。
<p class="">哈哈哈
<em class="">嘻嘻嘻</em>
</p>
5 replies • 2015-05-21 18:26:17 +08:00
 |
|
先对 node 进行操作,删除 em 这个 element 再提取文字?
|
 |
|
xxx.xpath('//p/text()')[0]
|
 |
|
@ ericls 这个方法我知道,可是有没有直接提取出来的方法?
|