Behavior of the scrapy xpath selector on h1-h6 tags
问题 Why does the following two code snippets give different outputs? The only difference between them is that the h1 tag in the first case is replaced with an h tag in the second case. Is this because the h1 tag has a special "meaning" in html? I tried with h1 through h6 and all of them give [] as output, while with h7 it starts to give [u'xxx'] as output. from scrapy import Selector # scrapy version: 1.2.2 text = '<h1><p>xxx</p></h1>' print Selector(text=text).xpath('//h1/p/text()').extract()