嗨,我正在研究scrapy
下面是我的代码
class examplespider(CrawlSpider):
name = "example"
domain_name = "www.example.com"
start_urls = ["http://www.example.com/sch/mobile-/67939/i.html?_catref=1"]
def parse(self,response):
hxs = HtmlXPathSelector(response)
for i in xrange(1,10):
yield Request(url="http://www.example.com/sch/mobile-/67939/i.html?_catref=1?_trkparms=65%253A12%257C66%253A1%257C39%253A1%257C72%253A3276&rt=nc&_catref=1&_dmpt=IN_Mobile_Phones&_trksid=p3286.c0.m14.l1513&_pgn=%d"%i,
callback=self.parse_item)
def parse_item(self,response):
print response,"Here it is................."
结果::
File "/home/local/username/project/example/example/spiders/example_spider.py", line 117, in parse
yield Request(url="http://www.example.com/sch/mobile-/67939/i.html?_catref=1?_trkparms=65%253A12%257C66%253A1%257C39%253A1%257C72%253A3276&rt=nc&_catref=1&_dmpt=IN_Mobile_Phones&_trksid=p3286.c0.m14.l1513&_pgn=%d"%i,
callback=self.parse_item)
exceptions.ValueError: unsupported format character 'A' (0x41) at index 61
谁能告诉我代码出了什么问题以及为什么显示不支持的格式字符代码错误,此处是否不支持 url,以及当我们提供一个没有格式说明符的单个整数时,我可以得到响应。请让我知道以上,
提前致谢。