Skip to content

Instantly share code, notes, and snippets.

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