0
我想從div'class'中刪除所有標記intr-txt:'js-interests-list-wrap js-interests-board js-wrap'whit本頁面的BeautifulSoup:https://badoo.com/profile/0266965187。我寫這樣的代碼:python BeautifulSoup findAll intr-txt
parsed_html = BeautifulSoup(html)
interese = parsed_html.findAll('div', {'class':'js-interests-list-wrap js-interests-board js-wrap'})
實際輸出爲
<div class="js-interests-list-wrap js-interests-board js-wrap" data-interests-type="hon-all"> <span class="js-intr intr"> <i class="intr-ico intr-ico--fashion"></i><!-- --><span class="intr-txt">Fotografii de modă</span> </span><span class="js-intr intr"> <i class="intr-ico intr-ico--food"></i><!-- --><span class="intr-txt">Mâncare de casă</span> </span><span class="js-intr intr"> <i class="intr-ico intr-ico--fashion"></i><!-- --><span class="intr-txt">Reviste</span> </span><span class="js-intr intr"> <i class="intr-ico intr-ico--food"></i><!-- --><span class="intr-txt">Gătitul</span> </span><span class="js-intr intr"> <i class="intr-ico intr-ico--food"></i><!-- --><span class="intr-txt">Să ies în oraș la masă</span> </span><span class="js-intr intr"> <i class="intr-ico intr-ico--travel"></i><!-- --><span class="intr-txt">Călătorii în lume</span> </span><span class="js-intr intr"> <i class="intr-ico intr-ico--hobby"></i><!-- --><span class="intr-txt">Fotografii</span> </span><span class="js-intr intr"> <i class="intr-ico intr-ico--music"></i><!-- --><span class="intr-txt">Dance</span> </span><span class="js-intr intr"> <i class="intr-ico intr-ico--hobby"></i><!-- --><span class="intr-txt">Fericire</span> </span><span class="js-intr intr"> <i class="intr-ico intr-ico--other"></i><!-- --><span class="intr-txt">Dansul</span> </span><span class="js-intr intr"> <i class="intr-ico intr-ico--hobby"></i><!-- --><span class="intr-txt">Shopping</span> </span><span class="js-intr intr"> <i class="intr-ico intr-ico--hobby"></i><!-- --><span class="intr-txt">Munți</span> </span> <div class="btn btn--sm btn--white btn--ico"><i class="icon ico--etc"><a href="https://badoo.com/signup/" class="b-link"></a></i></div> </div>
需要僅輸出格式的文本是這樣的:
Fotografii de modă,
Să dorm cu cineva în brațe,
Munți,
Photography,
Reviste,
Shopping,
Dance,
Fotografii,
Dansul,
Fericire,
Bucătărie,
Gătitul
怎麼能提取這個樣子?