Skip to content
Advertisement

Replacing characters in Scrapy item

I’m trying to scrape from a commerce website using Scrapy. For the price tag, I want to remove the “$”, but my current code does not work.

JavaScript

What is the appropriate method to remove characters when using Scrapy?

Advertisement

Answer

extract() would return you a list, you can use extract_first() to get a single value:

JavaScript

Or, you can use the .re() method, something like:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement