콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
5324 화면

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

아바타
취소
관련 게시물 답글 화면 활동
2
12월 23
28180
2
5월 24
1667
0
1월 21
4788
1
5월 18
4793
3
1월 16
18747