0
Я хочу получить содержимое div с классом «gt-read», и в div есть еще один div, который имеет другой класс. Ниже приведен код, фрагмент скрипта:
Получите содержимое div в div с помощью BeautifulSoup?
Сценарии:
data = """
<div class='gt-read'>
<!-- no need -->
<!-- some no need -->
<b>Bold text</b> - some text here <br/>
lorem ipsum here <br/>
<strong> Author Name</strong>
<div class='some-class'>
<script>
#...
Js script here
#...
</script>
</div>
</div>
"""
soup = BeautifulSoup(data, 'lxml')
get_class = soup.find("div", {"class" : "detail_text"})
print 'notices', notices.get_text()
print 'notices', notices
и я хочу результаты, как это:
<b>Bold text</b> - some text here <br/>
lorem ipsum here <br/>
<strong> Author Name</strong>
Пожалуйста, помогите.
Это работа из моего дела, спасибо. это очень полезно! –