我正在尝试抓取此 [1] 网页。我想提取字符串“WORK FROM HOME,PACKING”。我是 无法使用下面的代码访问强标签。我使用的是 Beautiful Soup。
job = soup.find('li', class_='clearfix job-bx wht-shd-bx')
job_name = job.header.h2.a.find_all('strong',_class="blkclor")
print(job_name)
<块引用>
结果 = [](无)
<块引用>预期结果:在家工作,打包
答案 0 :(得分:0)
这应该有效。
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())