首页| 论坛| 消息
主题:xpath抓取的值有空格换行符等问题
回帖:#每爬完一个网页会回调parse方法
def parse(self, response):
hx=response.xpath('//td[@class="zwmc"]/div/a')
#选取href里有"450836..."
print('_________________________')
print(hx[0].select("@href").extract()) # 取长度
print(hx[0].select("text()").extract()) # 取长度
下一楼›:import scrapy
class QuoteSpider(scrapy.Spider):
name = 'quote'
start_u ..
‹上一楼:https://blog.csdn.net/lishk314/article/details/83539622

def parse(self, response) ..

查看全部回帖(10)
«返回主帖