首页 > 解决方案 > 如何使用 Beautiful Soup 从 href 标签下的标签中提取字符串?

问题描述

标签: pythonweb-scraping

解决方案


这应该有效。

r = requests.get("https://www.timesjobs.com/candidate/job-search.html?searchType=personalizedSearch&from=submit&txtKeywords=work+from+home&txtLocation=")

b = BeautifulSoup(r.content)

for i in b.select("h2>a"):
    print(i.text.strip())

推荐阅读