Python CSS parser?

Has anyone written a Python CSS parser? Specifically, what I want to do is use xml.dom.ext.reader.HtmlLib to get a DOM for an HTML document, and then implement a node.getElementsBySelector() function. I could port Simon’s Javascript code to Python, but it doesn’t handle pseudo-elements and so on. If someone’s written this then I don’t have to :) Mark Paschal has something similar, but it doesn’t support combinators (like foo > bar) and that’s important.

I'm currently available for hire, to help you plan, architect, and build new systems, and for technical writing and articles. You can take a look at some projects I've worked on and some of my writing. If you'd like to talk about your upcoming project, do get in touch.

More in the discussion (powered by webmentions)

  • (no mentions, yet.)