У меня есть следующий html (разрывы строк, отмеченные \n):
...
<tr>
<td class="pos">\n
"Some text:"\n
<br>\n
<strong>some value</strong>\n
</td>
</tr>
<tr>
<td class="pos">\n
"Fixed text:"\n
<br>\n
<strong>text I am looking for</strong>\n
</td>
</tr>
<tr>
<td class="pos">\n
"Some other text:"\n
<br>\n
<strong>some other value</strong>\n
</td>
</tr>
...
Как найти текст, который я ищу? Код ниже возвращает сначала найденное значение, поэтому мне нужно как-то отфильтровать Исправленный текст.
result = soup.find('td', {'class' :'pos'}).find('strong').text
Upd. Если я использую следующий код:
title = soup.find('td', text = re.compile(ur'Fixed text:(.*)', re.DOTALL), attrs = {'class': 'pos'})
self.response.out.write(str(title.string).decode('utf8'))
то он возвращает только Фиксированный текст:.