我有以下的HTML,在这里我只想拿到产品名称而忽略html.How的其余部分,我可以做到这一点美丽的汤忽略内部HTML
我使用beautifulsoup Apple iPhone 4 Verizon
<h1 itemprop="itemreviewed">Apple iPhone 4 Verizon
<div class="right">
<span class="s_button_follow_special" style="display: block">
<a href="javascript:;" style="display: block" onclick="subscribe(this, 1, 5132);" class="follow_1_5132 s_button_2 s_button_follow" title="Follow Apple iPhone 4 Verizon"><em class="s_icon s_icon_follow"></em>Follow</a>
<a class="s_button_2 s_button_follow_arrow" href="javascript:;" onclick="subscribe(this, 1, 5132, '', 2);"></a>
</span>
<a href="javascript:;" style="display: none" onclick="subscribe(this, 1, 5132);" class="unfollow_1_5132 s_button_2 s_button_follow_disabled s_button_following" title="Unfollow Apple iPhone 4 Verizon"><span><em class="s_icon s_icon_following"></em>Following</span></a>
</div>
</h1>
header= soup('h1', {'itemprop' : 'itemreviewed'})
我的例子 – Rajeev 2012-07-31 13:57:02