I'm trying to get a clean output because When I scrape the website it gives, reviewed 7/20/2015 so I am trying to strip it so it only shows 7/20/2015. This is what I've been trying and when I test it by itself making a mock dict and populate it with values this code works but not in scrapy. I assume Field()
is just dict = {value:[],value2:[]}
so I dont know Why it does not work on Field()
Here's the code snippet
for j in range(len(item['date'])):
item['date'][j][9:].strip()
我将使用选择器的内置re()
方法:
response.xpath("//div[@id='test']/text()").re(r"\d{1,2}/\d{1,2}/\d{4}")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.