Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
self.product_urls.extend(hxs.select("//div[@id="product-list"]//div[@class="product-images"]/table/tr[1]//a')").extract())
这行代码给了我一个异常“无效路径”,我猜“产品列表”有问题我怎样才能写相同的@id而不会出现错误?
问题在于额外的括号,这是正确的语法。
self.product_urls.extend(hxs.select('//div[@id="product-list"]//div[@class="product-images"]/table/tr[1]//a').extract())
google 应该是你最好的朋友解决这类问题,你还需要学习 Xpath/python 基础知识