Created
December 21, 2016 19:40
-
-
Save z-a-f/66cadd5140b13da26147922d3bd77de5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
""" | |
Convert any text to a set of HTML codes. | |
You can use it against email and phone number HTML parsers | |
""" | |
def htmlize(text): | |
assert(isinstance(text, str)) | |
res = '' | |
for char in text: | |
res += '&#'+str(ord(char))+';' | |
return res | |
if __name__ == '__main__': | |
print htmlize(sys.argv[1]) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment