>>> from scrapy.selector import Selector
>>> sel = Selector(text='<span class="pl">Country:</span>China<br/>')
>>> 
sel.xpath('//span[text()="Country:"]/following-sibling::text()').extract()
[u'China']
>>> sel = Selector(text='<span class="pl">Country:</span>\nChina<br/>')
>>> 
sel.xpath('//span[text()="Country:"]/following-sibling::text()').extract()
[u'\nChina']


El jueves, 18 de diciembre de 2014 08:36:12 UTC-2, cherryunix escribió:
>
> Hi Dudes,
>     i'm a beginner with scrapy,and i met a problem about selector.Here is 
> the particular situation.
>     i want to select a certain string between 
> </span> and <br/>
>
> for instance 
> <span class="pl">Country:</span>
> China
> <br/>
>  
> i want to select "China" From this Html File.Here is my code 
>
> sel.xpath("*").re(r'Country:</span>\s*(.*)')
>
> but i can't achieve my goal with this code,what should i do?
>
>
>

-- 
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/d/optout.

Reply via email to