org.apache.commons.lang.StringEscapeUtils in python
is there any python module or code that implements the org.apache.commons.lang.StringEscapeUtils.escapeH开发者_JS百科tml ?
exactly the same as in http://commons.apache.org/lang/api/org/apache/commons/lang/StringEscapeUtils.html#escapeHtml(java.lang.String)
i googled around but could only find the cgi.escape function that doesn't do the same thing.
thanks in advance, sorry for the english :D
This is for XML and not for HTML, but it might fit your needs: Escaping XML
>>> from xml.sax.saxutils import escape
>>>
>>> escape("< & >")
'< & >'
精彩评论