gpt4 book ai didi

python - 在 Beautiful Soup 中使用 css 选择器获取正确的节点?

转载 作者:太空宇宙 更新时间:2023-11-03 15:31:41 26 4
gpt4 key购买 nike

对于链接,

http://www.jabong.com/Adidas-Base-Mid-Dd-Blue-Round-Neck-T-Shirt-2733238.html

...我需要获取产品 Fabric 详细信息,“聚酯纤维”。但我得到“Fabric”作为输出。下面是部分代码。

soup.find_all("span", {"class":"product-info-left"})[0].text

最佳答案

找到您的节点next_sibling

soup.find_all("span", {"class":"product-info-left"})[0].next_sibling.text

关于python - 在 Beautiful Soup 中使用 css 选择器获取正确的节点?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42853892/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com