0
感谢您的关注! 我试图在搜索结果中检索产品的href。 例如本页:Beautifulsoup检索href列表
但是,当我缩小到产品图像类,retrived href是图像链接.... 任何人都可以解决这个问题吗?提前致谢!
url = 'http://www.homedepot.com/b/Husky/N-5yc1vZrd/Ntk-All/Ntt-chest%2Band%2Bcabinet?Ntx=mode+matchall&NCNI-5'
content = urllib2.urlopen(url).read()
content = preprocess_yelp_page(content)
soup = BeautifulSoup(content)
content = soup.findAll('div',{'class':'content dynamic'})
draft = str(content)
soup = BeautifulSoup(draft)
items = soup.findAll('div',{'class':'cell_section1'})
draft = str(items)
soup = BeautifulSoup(draft)
content = soup.findAll('div',{'class':'product-image'})
draft = str(content)
soup = BeautifulSoup(draft)
真棒!你能告诉我如何将它们保存到列表中吗?所以我可以实际输出它们。 –
@ plainvanilla好的,更新了答案。 – alecxe