简体   繁体   English

如何用漂亮的汤从html获取数据

[英]how to get data from html with beautiful soup

the output of this code: 此代码的输出:

productNameText = down_page.find(id='productNameText')
print(productNameText)

gives: 得到:

[u'\n', <h1>

            Bold Print Short
        </h1>, u'\n']

How can I gently take only Bold Print Short text from here Thanks 我怎样才能从这里轻轻地只加粗字体

 productNameText = down_page.find(id='productNameText').get_text()
 print productNameText

get_text() Beautiful Soup documentation get_text()漂亮的汤文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM