有沒有一種很好的方法(例如BeautifulSoup)來簡化HTML表格。我使用的請求,以獲得表,並提取與BeautifulSoup表中,但我需要的表走的:Python簡化HTML表格
<table>
<thead></thead>
<tbody>
<tr>
<td><a id="bar">Some text<br></br><span class="foobar">foo </span><small class="foo">bar!</small></a></td>
</tr>
</tbody>
</table>
到:
<table>
<thead></thead>
<tbody>
<tr>
<td>Some text\nfoo bar!</td>
</tr>
</tbody>
</table>
通過一個簡單的方法,那麼我想不必去每個標籤和使用soup.get_text()。
爲什麼要'
'產量只有一個'\ N'? – Xufox
它應該是
,對不起。我知道它可能是
。但這些是我正在使用的數據。 –