MCPcopy Create free account
hub / github.com/gawel/pyquery / xpath_last_pseudo

Method xpath_last_pseudo

pyquery/cssselectpatch.py:65–76  ·  view source on GitHub ↗

Matches the last selected element:: >>> from pyquery import PyQuery >>> d = PyQuery(' ') >>> d('p:last') [ ] ..

(self, xpath)

Source from the content-addressed store, hash-verified

63 return xpath
64
65 def xpath_last_pseudo(self, xpath):
66 """Matches the last selected element::
67
68 >>> from pyquery import PyQuery
69 >>> d = PyQuery('<div><p></p><p class="last"></p></div>')
70 >>> d('p:last')
71 [<p.last>]
72
73 ..
74 """
75 xpath.add_post_condition('position() = last()')
76 return xpath
77
78 def xpath_even_pseudo(self, xpath):
79 """Matches even elements, zero-indexed::

Callers

nothing calls this directly

Calls 1

add_post_conditionMethod · 0.80

Tested by

no test coverage detected