python - XPATH: Specific word in paragraph -
i have been trying figure out how exact xpath e.g. third word in paragraph:
e.g.:
<p>here text</p>
then if want third word ("some"), can't figure out how single out using xpath. however, focal point here not exact match of word "some", instead third word (whatever may be).
i have been trying this: ../p[3], doesn't help. use python , scrapy framework.
i hope can point me in right direction.
thank you.
if using scrapy, question tagged, consider using scrapy's .re()
support, i.e:
>>> response.xpath('//p/text()').re('\w+')[2] u'some'
Comments
Post a Comment