H
H
hey_umbrella2021-11-13 17:19:28
Python
hey_umbrella, 2021-11-13 17:19:28

How to get the word on the next line from a string?

Stupidly formulated the question, in general

<vim-test-item correct="true">Ответ</vim-test-item>

I need to go through the entire html and get the Answer, only where there is correct="true", now I do it like this
correct = anwerdecode.partition('correct="true">')[2].partition('</')[0]


How can I do the same, but now the html looks like this, that is, I need to get the 'tops' from here only already in the loop, because there are several answers:
<vim-select-item correct="true">
      <vim-select-item-title>вершины</vim-select-item-title>
    </vim-select-item>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Karbivnichy, 2021-11-13
@hottabxp

Or maybe it's better not to engage in perversion, but to use libraries for parsing html, for example, bs4.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question