0
特定の要素/クラスに囲まれた部分をhtmlを格納する変数から削除したいのですが、どうすればよいかわかりません。私はタグマッチングで要素を削除する方法
from urllib.parse import urlparse
newcontent = content.find("div", {"class":"Footer"}).extract()
以下のように実施する試み
例えば、次のHTML文書が変数に格納されている "コンテンツ"
<div class="content">
<h1>content</h1>
<p>content<p>
<p>content</p>
<div>
<!-- want to delete from here -->
<div class="Footer">
<div class=Footer-item>
...
...
</div>
</div>
ただし、次のエラーが
TypeError: slice indices must be integers or None or have an __index__ method
を発生しました
あなたは良い解決策があれば教えてください。