Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
5273 Widoki

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..

Awatar
Odrzuć
Autor Najlepsza odpowiedź

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

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
2
gru 23
28128
2
maj 24
1642
0
sty 21
4725
1
maj 18
4763
3
sty 16
18717