from scrapy.shell import inspect_response
inspect_response(response, self)第一种方法非常实用,normalize-space用在属性上,如
response.xpath("//div[normalize-space(@class)='nav']/text()")第二种方法:normalize-space用结果上,如
response.xpath("normalize-space(//div[normalize-space(@class)='nav']/text())")response.xpath("string(.)")