<p><a href><rel>
次の html コードから etc以外の完全なテキストを抽出する必要があります。
<p>Many of the features that made the Samsung Galaxy S4 one of the most anticipated phones in recent history -- such as its 5-inch 1920 x 1080 <a href="http://www.bubblews.com/news/421662-samsung-galaxy-s4-worlds-first-full-hd-super-amoled-display" rel="nofollow" target="_blank">Full HD Super AMOLED display</a>, its powerful processors (<a href="http://www.samsung.com/global/business/semiconductor/minisite/Exynos/blog_Spotlight_on_the_Exynos5Octa.html" rel="nofollow" target="_blank">Samsung Exynos 5 Octa</a> in the international version and <a href="http://www.qualcomm.com/snapdragon/blog/topics/snapdragon 600" rel="nofollow" target="_blank">Qualcomm Snapdragon 600</a> in the U.S. version) and 16GB, 32GB and 64GB storage options -- are now bringing grief to those who rushed to purchase the fourth-generation Galaxy S series smartphone upon its late April release.</p>
私は以下のコードを試しました
from bs4 import BeautifulSoup
from urllib2 import urlopen
BASE_URL = "http://www.chicagoreader.com"
def get_category_links(section_url):
html = urlopen(section_url).read()
soup = BeautifulSoup(html, "lxml")
for div in soup.findall("div", attrs={'class':'field-content'}):
print div.find("p").content[0]
しかし、次の出力を提供しています
5 インチ 1920 x 1080 など、Samsung Galaxy S4 を最近の歴史で最も期待される携帯電話の 1 つにした機能の多く
完全なテキストを取得できません。href および rel などのタグの後にテキストが表示されるはずです。以下の出力を取得する方法を教えてください。
5 インチ 1920 x 1080 フル HD スーパー AMOLED など、Samsung Galaxy S4 を最近の歴史で最も期待される携帯電話の 1 つにした機能の多くは、その強力なプロセッサを表示します。Samsung Exynos 5 Octa の国際版と "> Qualcomm Snapdragon 600 (米国版) と 16GB、32GB、および 64GB のストレージ オプションは、4 月下旬にリリースされた第 4 世代の Galaxy S シリーズ スマートフォンを急いで購入した人々に悲しみをもたらしています。
ありがとう..