The xpath () function in lxml usually returns a list of elements.
If I have XPath that I expect to return exactly one element, then what's the best way:
- Make sure one item is returned or throw an exception, and:
- Get this item (as opposed to a single-item list)?
I am really looking for an analogue to the SQLAlchemy one () function.
source share