L
L
Levan Tyurin2018-07-02 18:16:15
Python
Levan Tyurin, 2018-07-02 18:16:15

How to get to the corresponding directory?

The row block contains two blocks with the same name col-xs-12. I need to get exactly
to the second block, and not to the first, how can I do this in python?

lis = soup.find('div', id='main').find('div', id='content').find('div', class_='row').find('div', class_='col-xs-12').find('div', class_='row')

<div class="row">

    <div class="col-xs-12 hidden-xs">….

    <div class="col-xs-12">………. # вот сюда надо зайти


</div>

5b3a44dd573ae633967509.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
MrOnatsky, 2018-07-02
@MrOnatsky

Number the blocks with an additional name (col-xs-12-1, col-xs-12-2, col-xs-12-3). And then I think it's clear.

D
Dimonchik, 2018-07-02
@dimonchik2013

doc.xpath(('//div[@class="col-xs-12 hidden-xs"]/following::div[1]/text()'))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question