This is not scrapy question, but a Python one. You should replace > 'h1_'i
With > 'h1_%d' % i That's how you do it in Python. For more about this, refer to: http://docs.python.org/2/library/string.html#template-strings Em 26/01/2014 11:41, "d4v1d" <[email protected]> escreveu: > Hello, > I would like to intercept (in a url) all the h1 (frequently the url have > more than one) > I try this > > In the file items.py > class DmozItem(Item): > h1_1 = Field() > h1_2 = Field() > h1_3 = Field() > > > And in the spider > [...] > def parse(self, response): > hxs = HtmlXPathSelector(response) > item = DmozItem() > for i in range (1,3): > item['h1_'i] = hxs.select('//h1/text()').extract() > [...] > > Unfortunately this don't work the variable i in "item['h1'_i]" return an > error > And i am not sur to intercept (with this method) all the h1 > > Could you please help me ? > Thanks in advance > Regards > > -- > You received this message because you are subscribed to the Google Groups > "scrapy-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/scrapy-users. > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "scrapy-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/scrapy-users. For more options, visit https://groups.google.com/groups/opt_out.
