From dd76322ef3780dd375ba4be4e417d977dbc8786e Mon Sep 17 00:00:00 2001 From: hoatle Date: Thu, 8 Oct 2015 15:55:08 +0700 Subject: [PATCH 1/2] use proper parentheses --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 29cd3824..8442bde3 100644 --- a/README.rst +++ b/README.rst @@ -44,6 +44,6 @@ Example:: [u'Hello', u'Parsel'] >>> >>> for e in sel.css('ul > li'): - print(e.xpath('.//a/@href')).extract_first() + print(e.xpath('.//a/@href').extract_first()) http://example.com http://scrapy.org From befb08e7e43333465654baa17519d31ff4437b30 Mon Sep 17 00:00:00 2001 From: hoatle Date: Thu, 8 Oct 2015 15:55:26 +0700 Subject: [PATCH 2/2] fix invalid xpath error --- docs/usage.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/usage.rst b/docs/usage.rst index 94053969..ea6773ce 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -114,7 +114,7 @@ If you want to extract only first matched element, you can call the selector ``. It returns ``None`` if no element was found:: - >>> selector.xpath('//div/[id="not-exists"]/text()').extract_first() is None + >>> selector.xpath('//div[@id="not-exists"]/text()').extract_first() is None True Notice that CSS selectors can select text or attribute nodes using CSS3