Is there a Python equivalent to the PHP function htmlspecialchars()?

Ian picture Ian · May 31, 2009 · Viewed 11k times · Source

Is there a similar or equivalent function in Python to the PHP function htmlspecialchars()? The closest thing I've found so far is htmlentitydefs.entitydefs().

Answer

Karl Guertin picture Karl Guertin · May 31, 2009

Closest thing I know about is cgi.escape.