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

返回一个SelectorList对象 http://scrapy-chs.readthedocs.io/zh_CN/0.24/topics/selectors.html#selectorlist
返回一个list
返回list中的第一个元素
返回SelectorList中的第一个元素(如果list为空抛出异常),返回的是一str类型,与3效果相同
返回SelectorList中的第一个元素中的第一个字符

相关文章:

  • 2021-12-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-29
猜你喜欢
  • 2021-07-22
  • 2021-08-01
  • 2022-12-23
  • 2022-12-23
  • 2022-02-19
  • 2022-03-01
相关资源
相似解决方案