Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 刮伤';强';刮痧_Python_Html_Css_Scrapy - Fatal编程技术网

Python 刮伤';强';刮痧

Python 刮伤';强';刮痧,python,html,css,scrapy,Python,Html,Css,Scrapy,我试图从下面的DOM中找到“Piza,意大利语”的地方: 我已尝试使用: restaurants = response.css('.restaurant-content') for restaurant in restaurants: name = restaurant.css('.serpItemList-Title::text').extract() cuisine = restaurant.css('infoText.infoText--primary.listing-

我试图从下面的DOM中找到“Piza,意大利语”的地方:

我已尝试使用:

restaurants = response.css('.restaurant-content')

for restaurant in restaurants:
    name = restaurant.css('.serpItemList-Title::text').extract()
    cuisine = restaurant.css('infoText.infoText--primary.listing-item--cuisineText::text').extract()
检索每个餐厅的名称时不会出现任何问题,但不会检索/填充菜肴

我怎样才能找回菜肴

注意,我希望在不使用xpath的情况下实现这一点,因为我需要遍历每个餐厅中的每个菜肴,xpath不支持这一点,它只需要DOM中的一个特定位置


提前谢谢。

我很难在看不到整件事的情况下说出什么是有效的。可能是
.div
?尝试使用Chrome扩展选择器小工具。如果你漏掉了一个点(.),它将帮助你达到1000%——可能只是
。infoText
就可以了