import scrapy
from scrapy.http import Request
class PushpaSpider(scrapy.Spider):
name = 'test'
start_urls = ['https://adv-tver.ru/lawyer/Pokrovskij184']
def parse(self, response):
rows = response.xpath("//table[@class='table']")[1:]
for row in rows:
a=row.xpath("//tr[1]//td[2]//text()").get()
b=row.xpath("//tr[2]//td[2]//text()").get()
c=row.xpath("//tr[3]//td[2]//text()").get()
d=row.xpath("//tr[4]//td[2]//text()").get()
e=row.xpath("//tr[5]//td[2]//text()").get()
f=row.xpath("//tr[6]//td[2]//text()").get()
g=row.xpath("//tr[7]//td[2]//text()").get()
yield{
'Ф.И.О.:':a,
}
当我在终端运行代码时,他们会给予我correct output
:
'Ф.И.О.:': 'Покровский\xa0Василий\xa0Васильевич'
当我做CSV FILE
时,他们给予我错误的输出,如下所示:
Ф.И.О.:ПокровÑкий ВаÑилий ВаÑильевич
1条答案
按热度按时间ql3eal8s1#
FEED_EXPORT_ENCODING
设置为“utf-8”。例如: