我想使用一些库将css选择器转换为xpath。任何人都可以向我解释返回值的含义以及我如何覆盖xpath,如//div//*[class@""]
from cssselect import GenericTranslator
try
sel = CSSSelector('div.w3-container.top')
except SelectorError:
print('Invalid selector.')
print(sel)
sel:
'descendant-or-self::div[@class and contains(concat(\\' \\', normalize-space(@class), \\' \\'), \\' w3-container \\') and (@class and contains(concat(\\' \\', normalize-space(@class), \\' \\'), \\' top \\'))]'
答案 0 :(得分:1)