我想要将元素的文本与其子元素的文本组合在一起.我拥有的元素是这样的.
<td>
<a> This </a>
" is placement "
<span>
<span> text </span>
</span>
" to demonstrate "
<span>
<span> my point </span>
</span>
</td>
我最初的 idea 是这样做
children = d.findChildren()
description = ''
for child in children:
if child.text:
description += child.text
这只返回文本‘This Text My point’,因为它忽略了主元素中的文本.我如何才能得到完整的句子‘这是用来证明我的观点的放置文本’?