Skip to content

Instantly share code, notes, and snippets.

Created March 16, 2012 13:18
Show Gist options
  • Save anonymous/2050036 to your computer and use it in GitHub Desktop.
Save anonymous/2050036 to your computer and use it in GitHub Desktop.
hex_buffer
def hex_buffer(buf):
retstr=''.join(map(lambda c:'\\x%02x'%ord(c),buf))
retstr="E'"+retstr+"'"
return retstr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment