ElementPath vs. XPath expression
21 Apr
2018
21 Apr
'18
8:55 p.m.
Hello, I’m trying to select the last child of an element. However, I noticed the following with lxml 4.1.1 last = el.find("./*[last()]") returns the first child. last, *_ = el.xpath("./*[last()]") returns the last child. According to the documentation: http://effbot.org/zone/element-xpath.htm both should work though. Also, just out of curiosity, would the following have any advantage (perf?) over the above? *_, last = list(el) Thanks! Jens -- Jens Tröger http://savage.light-speed.de/
2188
Age (days ago)
2189
Last active (days ago)
4 comments
2 participants
participants (2)
-
Jens Tröger
-
Stefan Behnel