Skip to content

Commit

Permalink
More replaces of references to old sel shortcut
Browse files Browse the repository at this point in the history
  • Loading branch information
dangra committed Apr 13, 2015
1 parent f9208db commit f71175a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/topics/selectors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,12 @@ method, as follows::

If you want to extract only first matched element, you can call the selector ``.extract_first()``

>>> sel.xpath('//div[@id="images"]/a/text()').extract_first()
>>> response.xpath('//div[@id="images"]/a/text()').extract_first()
u'Name: My image 1 '

It returns ``None`` if no element was found:

>>> sel.xpath('//div/[id="not-exists"]/text()').extract_first() is None
>>> response.xpath('//div/[id="not-exists"]/text()').extract_first() is None
True

Notice that CSS selectors can select text or attribute nodes using CSS3
Expand Down Expand Up @@ -383,7 +383,7 @@ with groups of itemscopes and corresponding itemprops::
... ...
... </div>
... """
>>>
>>> sel = Selector(text=doc, type="html")
>>> for scope in sel.xpath('//div[@itemscope]'):
... print "current scope:", scope.xpath('@itemtype').extract()
... props = scope.xpath('''
Expand Down

0 comments on commit f71175a

Please sign in to comment.