mardi 18 septembre 2018

How to distinguish two lxml.etree._ElementUnicodeResult with the same content?

I use lxml.etree to execute xpaths like:

open_time_Mon = selector.xpath('//span[. = "Monday"]/following-sibling::span/text()')
open_time_Tue = selector.xpath('//span[. = "Tuesday"]/following-sibling::span/text()')
assert open_time_Mon != open_time_Tue

will report AssertionError.

Although both two nodes have the contents of '10:00 - 20:00', they are essentially different. However, selector.xpath returns lxml.etree._ElementUnicodeResult, which is pure string.

Is there any way to distinguish these two results?




Aucun commentaire:

Enregistrer un commentaire