OR condition in XPath for Scrapy

Pramod

Currently, I am stuck with the problem in XPath and Scrapy where I have to parse example like this.

<dl class>
<x class="another"><a>data 1</a></x>
<y class="y"><b>data 2</b></y>
</dl>

I want to fetch the data between and tag. So, I was wondering if there is solution like

dl=response.xpath(".//dl")
for row in dl.xpath(".//a or .//b")

I want to know if I can put the OR condition.

unutbu

Use |:

dl.xpath(".//a | .//b")

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

Related 관련 기사

뜨겁다태그

보관