因为我想从https://www.nike.com/gb/t/air-max-viva-shoe-ZQTSV8/DB5268-003获取描述文本 但在输出上不打印任何内容
import requests
from bs4 import BeautifulSoup
import re
url ="https://www.nike.com/gb/t/air-max-viva-shoe-ZQTSV8/DB5268-003"
response = requests.get(url)
soup = BeautifulSoup(response.text, 'lxml')
headline1 = soup.find('h3', class_ = 'epdp-headline-md headline-1')
headline = soup.find('div',class_ = 'epdp-headline-sm body-1')
print(headline1,headline)
试试这个
您需要使用这个类
pt6-sm prl6-sm prl0-lg
来提取描述返回描述
如果希望清理HTML对象,可以使用下面的代码段
输出:
这将使用选择而不是查找
相关问题 更多 >
编程相关推荐