Skip to content

Instantly share code, notes, and snippets.

@kgleeson
Forked from zeffii/gist:3702095
Created September 11, 2012 21:13
Show Gist options
  • Save kgleeson/3702104 to your computer and use it in GitHub Desktop.
Save kgleeson/3702104 to your computer and use it in GitHub Desktop.
def escape_html(s):
for i, v in ('&', '&amp;'), ('<', '&lt;'), ('"', '&quot;'), ('>', '&gt;'):
if i in s:
s = s.replace(i,v)
return s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment