views:

364

answers:

1

There is cgi.escape but that appears to be implemented in pure python. It seems like most frameworks like Django also just run some regular expressions. This is something we do a lot, so it would be good to have it be as fast as possible.

Maybe C implementations wouldn't be much faster than a series of regexes for this?

A: 

See lxml, which is based on libxml2. While it's primarily a XML library, HTML support is available.

Charles Duffy