thanks for you help
you have right, it was not a scrapy question
I deleted my question but too late
i understand that scrapy keeps all the h1 and i just have to read them one 
by one
this is perfect thanks

    def parse(self, response):
        hxs = HtmlXPathSelector(response)
        item = DmozItem()
        item['h1'] = hxs.select('//h1/text()').extract()
        for j in range(len(item['h1'])):
                print 'h1_'%j



Le dimanche 26 janvier 2014 20:23:50 UTC+1, Anderson Caco a écrit :
>
> 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] <javascript:>> 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] <javascript:>.
>> To post to this group, send email to [email protected]<javascript:>
>> .
>> 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.

Reply via email to