I'm trying to convert the following element:
@[width="300"]
That I convert to xpath as:
//*[@width="300"]
To a css selector. Because with lxml if I run:
selector = "@[width="300"]"
tree = lxml.html.fromstring(fparse(fileIn).to_string())
tree.cssselect(selector)
I get the following error:
Expected selector, got <DELIM '@' at 0>
How can I convert it without using external libraries not included in lxml itself? I need to use cssselect and not xpath because I have other cases where my program need to parse selectors like the following one:
@[width="300"] > p > a