libb.htmlquote

htmlquote(text)[source]

Encode text for safe use in HTML.

Parameters:

text (str) – Text to encode.

Returns:

HTML-encoded string.

Return type:

str

Example:

>>> htmlquote(u"<'&\">")
'&lt;&#39;&amp;&quot;&gt;'