以下是我的代码,从url获得产品名称“RENU FRESH LENS SOLUTION 120 ML”..这就是p标签..我只需要这个名称。使用Scraping获取产品名称
import requests
import lxml
from bs4 import BeautifulSoup
url = "http://www.lenskart.com/renu-fresh-lens-solution-100-ml.html"
source = requests.get(url)
data = source.content
soup = BeautifulSoup(data, "lxml")
pn = soup.find_all("div", {"class":"prcdt-overview"})[0].text
print pn
好。你也有问题吗? – DeepSpace
你面临的问题是什么? – saeleko
只能得到产品名称“RENU FRESH LENS SOLUTION 120 ML”而不是全部内容 – Nitin