Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
5218 Представления

Hello all,

I am trying to fetch the text of tag using python regular expression and i will get result but it is not give text if the children tag has any children tag.

Like:

<table>

<tbody>

<tr>

<td>

<p>

Text-1

</p>

</td>

</tr>


<tr>

<td>

<p>

<span>Text-2</span>

</p>

</td>

</tr>

</tbody>

</table>


rows = tree.findall("tbody/tr/td/p")

so i want text from all p tag. if the p tag contains inner tag then also i get text of that tag. in short i want all text inside p tag. so can anyone help me.

or suggest that which function is used for finding all text inside tag or inner tag.

Thanks in advance..

Аватар
Отменить
Автор Лучший ответ

Refer: https://stackoverflow.com/questions/9471419/how-to-select-parent-based-on-the-child-in-lxml

Аватар
Отменить
Related Posts Ответы Просмотры Активность
2
дек. 23
28041
2
мая 24
1586
0
янв. 21
4653
1
мая 18
4710
3
янв. 16
18623