开发者

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("< & >")
'&lt; &amp; &gt;'
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜