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 picked one off the web awhile back, though I’m not sure it does everything you want it to. Remind me if I don’t email it to you.