> Through trial and error, it looks like xpath() returns an array, even if only > one > element is found in the tree.
Behold the power of the great docs: https://lxml.de/xpathxslt.html#xpath "[...] XPath return values The return value types of XPath evaluations vary, depending on the XPath expression used: - True or False, when the XPath expression has a boolean result - a float, when the XPath expression has a numeric result (integer or float) - a 'smart' string (as described below), when the XPath expression has a string result. - a list of items, when the XPath expression has a list as result. The items may include Elements (also comments and processing instructions), strings and tuples. Text nodes and attributes in the result are returned as 'smart' string values. Namespace declarations are returned as tuples of strings: (prefix, URI). [...]" ;-) Best regards, Holger Landesbank Baden-Wuerttemberg Anstalt des oeffentlichen Rechts Hauptsitze: Stuttgart, Karlsruhe, Mannheim, Mainz HRA 12704 Amtsgericht Stuttgart HRA 4356, HRA 104 440 Amtsgericht Mannheim HRA 40687 Amtsgericht Mainz Die LBBW verarbeitet gemaess Erfordernissen der DSGVO Ihre personenbezogenen Daten. Informationen finden Sie unter https://www.lbbw.de/datenschutz. _______________________________________________ lxml - The Python XML Toolkit mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/lxml.python.org/ Member address: [email protected]
