【发布时间】:2017-08-11 02:35:07
【问题描述】:
我需要从这个 HTML 代码中打印出 USA 和 Canada 字样:
<div class="txt-block">
<h4 class="inline">Country:</h4>
<a href="/search/title?country_of_origin=us&ref_=tt_dt_dt" itemprop="url">USA</a>
<span class="ghost">|</span>
<a href="/search/title?country_of_origin=ca&ref_=tt_dt_dt" itemprop="url">Canada</a>
</div>
我怎样才能得到bs4的单词?我用谷歌搜索了它,但没有发现任何有用的东西。
【问题讨论】:
-
您究竟尝试了什么,有什么问题?如果答案看起来很可能是“什么都没有”,那么就离开并改变它。
-
到目前为止您尝试过什么?你的bs4代码是什么?
标签: python html python-3.x beautifulsoup