网页抓取 python <span class="b6a29bc0" aria-label="Beds">2</span>, <span class="b6a29bc0" aria-label="Baths">2</span>
Web scraping python <span class="b6a29bc0" aria-label="Beds">2</span>, <span class="b6a29bc0" aria-label="Baths">2</span>
我必须在 html 代码下方提取文本内容以进行 python 网络抓取,问题在于 class 参数所有三个变量都具有相同的 class参数,所以我尝试使用无效的 arial-label。
2,
3
Property_beds = response.css('.b6a29bc0::text').extract()
结果
获取两个变量"Beds","Baths",我只想要单个变量 baths
'Property_beds': [2,3]
但我想在 response.css() 中包含 aria-label="Baths",我尝试使用以下代码但输出列表为空
Property_beds = response.css('span.b6a29bc0aria-label[attribute="Beds"]::text').extract()
单身
Property_beds = response.css('span.b6a29bc0[aria-label=Beds]::text').extract()
对于多个节点使用 css 或语法:
response.css('span.b6a29bc0[aria-label=Beds], span.b6a29bc0[aria-label=Studio]').getall()
我必须在 html 代码下方提取文本内容以进行 python 网络抓取,问题在于 class 参数所有三个变量都具有相同的 class参数,所以我尝试使用无效的 arial-label。
2,
3
Property_beds = response.css('.b6a29bc0::text').extract()
结果 获取两个变量"Beds","Baths",我只想要单个变量 baths
'Property_beds': [2,3]
但我想在 response.css() 中包含 aria-label="Baths",我尝试使用以下代码但输出列表为空
Property_beds = response.css('span.b6a29bc0aria-label[attribute="Beds"]::text').extract()
单身
Property_beds = response.css('span.b6a29bc0[aria-label=Beds]::text').extract()
对于多个节点使用 css 或语法:
response.css('span.b6a29bc0[aria-label=Beds], span.b6a29bc0[aria-label=Studio]').getall()