我做了一个密码:
from newspaper import Article
url = 'http://www.infomoney.com.br/mercados/acoes-e-indices/noticia/7345670/dow-jones-tem-nova-derrocada-puxa-ibovespa-para-segunda-semana'
a = Article(url, language='pt')
a.download()
a.parse()
print(a.text)
但是我需要带有html标记的文本,例如,我需要文本中的img标记。在
您可以通过
html
成员获取html。在这个问题是一年前提出的,但有人可能会通过谷歌找到这个问题。在
你可以用“a.article_html”获取文章文本中的图像和其他html。在
记住参数“keep_article_html=True”
相关问题 更多 >
编程相关推荐