Skip to content Skip to sidebar Skip to footer

Scrapy Get Result In Shell But Not In Script

one topic again ^^ Based on recommendations here, I've implemented my bot the following and tested it all in shell : name_list = response.css('h2.label.title::text').extract()

Solution 1:

product_price is a string, given that you are joining the results of the selector in:

product_price = ''.join(response.css('.product-pricing__main-price  ::text').extract())

Then, when you use zip, you'll be splitting that string in parts, thus you'll have the \n for the first item, as it's probably the first character in product_price.

Check this example:

>>> for i, j, k inzip([1, 2, 3, 4], [5, 6, 7, 8], 'abcd'):
        print (i, j, k)

Output:

15a26b37 c
48 d

Post a Comment for "Scrapy Get Result In Shell But Not In Script"