关于xpath的使用

2018-11-23  本文已影响0人  煮茶温酒曲终人散

How to use the Xpth

about '//' , '/' , and 'text()'

测试
 title = response.xpath('//div[@class="entry-header"]/h1/text()')

Look at the code under the sentence

//div[@class="entry-header"]/h1/text()

//div[class="entry-header"]
find the tag <div> which class is "entry-header" in the all text
/h1
find the tag <h1> in the <div class = "entry-header"></div>
/text()
get the text in the <h1></h1>

上一篇 下一篇

猜你喜欢

热点阅读