Skip to content

Instantly share code, notes, and snippets.

@adiroiban
Created December 15, 2015 11:30
Show Gist options
  • Save adiroiban/adea8a520358c6a71be5 to your computer and use it in GitHub Desktop.
Save adiroiban/adea8a520358c6a71be5 to your computer and use it in GitHub Desktop.
obfuscation
# Backslash-escape errorCode. Python 3.5 can do this natively
# ("backslashescape") but Python 2.7 and Python 3.4 can't.
if _PY3:
errorCodeForMessage = "".join(
"\\x%2x" % c if c >= 0x80 else chr(c)
for c in errorCode)
else:
errorCodeForMessage = "".join(
"\\x%2x" % ord(c) if ord(c) >= 0x80 else c
for c in errorCode)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment