From 5f18816428da7de7debc159a0a5e1960fb0ccf67 Mon Sep 17 00:00:00 2001 From: ncp1113 Date: Mon, 31 Mar 2014 16:14:22 -0400 Subject: [PATCH] for loops have to have a : at the end of the line changed 3 instances --- docs/topics/selectors.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/topics/selectors.rst b/docs/topics/selectors.rst index 29755dec0..afdaae6e7 100644 --- a/docs/topics/selectors.rst +++ b/docs/topics/selectors.rst @@ -244,17 +244,17 @@ At first, you may be tempted to use the following approach, which is wrong, as it actually extracts all ``

`` elements from the document, not only those inside ``

`` elements:: - >>> for p in divs.xpath('//p') # this is wrong - gets all

from the whole document + >>> for p in divs.xpath('//p'): # this is wrong - gets all

from the whole document >>> print p.extract() This is the proper way to do it (note the dot prefixing the ``.//p`` XPath):: - >>> for p in divs.xpath('.//p') # extracts all

inside + >>> for p in divs.xpath('.//p'): # extracts all

inside >>> print p.extract() Another common case would be to extract all direct ``

`` children:: - >>> for p in divs.xpath('p') + >>> for p in divs.xpath('p'): >>> print p.extract() For more details about relative XPaths see the `Location Paths`_ section in the